Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #580 from codesy/auth-changed-header-579
for #579: send http header when auth changes
- Loading branch information
Showing
2 changed files
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
AUTH_CHANGING_PATHS = ['/accounts/logout/', '/accounts/github/login/callback/'] | ||
|
||
|
||
class AuthChangedMiddleware(object): | ||
""" | ||
Adds a custom HTTP header for the widget when auth state changes | ||
""" | ||
|
||
def process_response(self, request, response): | ||
if request.path in AUTH_CHANGING_PATHS: | ||
response['x-codesy-auth-changed'] = 'true' | ||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters