Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Refactor naming to use 'auth_remember'

  • Loading branch information...
commit 724d29e5303c62e3a4834c474f9d0816085540f3 1 parent 26e6c61
@dhaaker authored
View
2  auth_remember/backend.py
@@ -21,7 +21,7 @@ def authenticate(self, token_string, request):
utils.preset_cookie(request, token_string)
token.delete()
- user._remember_me_user = True
+ user._auth_remember_user = True
return user
def get_user(self, user_id):
View
14 auth_remember/middleware.py
@@ -19,15 +19,15 @@ def process_request(self, request):
return
user = django_auth.authenticate(token_string=token, request=request)
if user:
- user._remember_me_user = True
+ user._auth_remember_user = True
django_auth.login(request, user)
def process_response(self, request, response):
- remember_me_token = getattr(request, '_remember_me_token', None)
+ auth_remember_token = getattr(request, '_auth_remember_token', None)
- if remember_me_token is not None:
- if remember_me_token:
- utils.set_cookie(response, remember_me_token)
+ if auth_remember_token is not None:
+ if auth_remember_token:
+ utils.set_cookie(response, auth_remember_token)
else:
utils.delete_cookie(response)
return response
@@ -37,10 +37,10 @@ def process_response(self, request, response):
def set_user_is_fresh(sender, **kwargs):
request = kwargs['request']
user = kwargs['user']
- user.is_fresh = not getattr(user, '_remember_me_user', False)
+ user.is_fresh = not getattr(user, '_auth_remember_user', False)
request.session[SESSION_KEY] = user.is_fresh
@receiver(signals.user_logged_out)
-def remove_remember_me(sender, **kwargs):
+def remove_auth_remember(sender, **kwargs):
utils.preset_cookie(kwargs['request'], '')
View
5 auth_remember/utils.py
@@ -40,9 +40,9 @@ def preset_cookie(request, token_string):
"""
if token_string:
- request._remember_me_token = token_string
+ request._auth_remember_token = token_string
else:
- request._remember_me_token = ''
+ request._auth_remember_token = ''
def set_cookie(response, token):
@@ -62,4 +62,3 @@ def set_cookie(response, token):
def delete_cookie(response):
response.delete_cookie(COOKIE_NAME)
-
Please sign in to comment.
Something went wrong with that request. Please try again.