Changeset - 5bbcc0cac389
[Not reviewed]
default
0 2 0
Marcin Kuzminski - 15 years ago 2010-07-21 22:57:36
marcin@python-works.com
added session remove in forms, and added name and lastname to auth user
2 files changed with 5 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pylons_app/lib/auth.py
Show inline comments
 
@@ -74,12 +74,14 @@ def authfunc(environ, username, password
 
class  AuthUser(object):
 
    """
 
    A simple object that handles a mercurial username for authentication
 
    """
 
    def __init__(self):
 
        self.username = 'None'
 
        self.name = ''
 
        self.lastname = ''
 
        self.user_id = None
 
        self.is_authenticated = False
 
        self.is_admin = False
 
        self.permissions = {}
 

	
 

	
pylons_app/model/forms.py
Show inline comments
 
@@ -94,12 +94,14 @@ class ValidAuth(formencode.validators.Fa
 
                    from pylons_app.lib.auth import AuthUser
 
                    auth_user = AuthUser()
 
                    auth_user.username = username
 
                    auth_user.is_authenticated = True
 
                    auth_user.is_admin = user.admin
 
                    auth_user.user_id = user.user_id
 
                    auth_user.name = user.name
 
                    auth_user.lastname = user.lastname
 
                    session['hg_app_user'] = auth_user
 
                    session.save()
 
                    log.info('user %s is now authenticated', username)
 
                    
 
                    try:
 
                        user.last_login = datetime.datetime.now()
 
@@ -119,13 +121,13 @@ class ValidAuth(formencode.validators.Fa
 
                log.warning('user %s is disabled', username)
 
                raise formencode.Invalid(self.message('disabled_account',
 
                                         state=State_obj),
 
                                         value, state,
 
                                         error_dict=self.e_dict_disable)
 
            
 
            
 
        meta.Session.remove()                
 
class ValidRepoUser(formencode.validators.FancyValidator):
 
            
 
    def to_python(self, value, state):
 
        sa = meta.Session
 
        try:
 
            self.user_db = sa.query(User)\
0 comments (0 inline, 0 general)