Changeset - 95bc1801d480
[Not reviewed]
default
0 2 0
Søren Løvborg - 10 years ago 2015-09-09 12:21:25
sorenl@unity3d.com
auth: inline AuthUser.set_authenticated

This makes the following commits easier to follow, and makes it more
explicit that something weird is going on, with more cleanup needed.
2 files changed with 4 insertions and 6 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/auth.py
Show inline comments
 
@@ -626,10 +626,6 @@ class AuthUser(object):
 
        return "<AuthUser('id:%s[%s] auth:%s')>"\
 
            % (self.user_id, self.username, self.is_authenticated)
 

	
 
    def set_authenticated(self, authenticated=True):
 
        if not self.is_default_user:
 
            self.is_authenticated = authenticated
 

	
 
    def to_cookie(self):
 
        """ Serializes this login session to a cookie `dict`. """
 
        return {
 
@@ -650,7 +646,8 @@ class AuthUser(object):
 
        )
 
        if not au.is_authenticated and au.user_id is not None:
 
            # user is not authenticated and not empty
 
            au.set_authenticated(cookie.get('is_authenticated'))
 
            if not au.is_default_user:
 
                au.is_authenticated = cookie.get('is_authenticated')
 
        return au
 

	
 
    @classmethod
kallithea/lib/base.py
Show inline comments
 
@@ -116,7 +116,8 @@ def log_in_user(user, remember, is_exter
 

	
 
    auth_user = AuthUser(dbuser=user,
 
                         is_external_auth=is_external_auth)
 
    auth_user.set_authenticated()
 
    if not auth_user.is_default_user:
 
        auth_user.is_authenticated = True
 

	
 
    # Start new session to prevent session fixation attacks.
 
    session.invalidate()
0 comments (0 inline, 0 general)