Changeset - 5af2cd31c99b
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-05-22 20:49:38
marcin@python-works.com
logging info change on login form
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
pylons_app/model/forms.py
Show inline comments
 
@@ -63,32 +63,32 @@ class ValidAuth(formencode.validators.Fa
 
    def validate_python(self, value, state):
 
        sa = meta.Session
 
        crypted_passwd = get_crypt_password(value['password'])
 
        username = value['username']
 
        try:
 
            user = sa.query(Users).filter(Users.username == username).one()
 
        except (NoResultFound, MultipleResultsFound, OperationalError) as e:
 
            log.error(e)
 
            user = None
 
        if user:
 
            if user.active:
 
                if user.username == username and user.password == crypted_passwd:
 
                    log.info('user %s authenticated correctly', username)
 
                    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
 
                    session['hg_app_user'] = auth_user
 
                    session.save()
 
                    log.info('user %s is now authenticated', username)
 
                    return value
 
                else:
 
                    log.warning('user %s not authenticated', username)
 
                    raise formencode.Invalid(self.message('invalid_password',
 
                                             state=State_obj), value, state,
 
                                             error_dict=self.e_dict)
 
            else:
 
                log.warning('user %s is disabled', username)
 
                raise formencode.Invalid(self.message('disabled_account',
 
                                         state=State_obj),
 
                                         value, state, error_dict=self.e_dict)
 
            
0 comments (0 inline, 0 general)