Changeset - 00f883abdb0c
[Not reviewed]
default
0 1 0
Marcin Kuzminski - 15 years ago 2010-09-05 13:55:47
marcin@python-works.com
fixed a bug when given wrong username at login
broken in last reimplemntation of forms
1 file changed with 2 insertions and 5 deletions:
0 comments (0 inline, 0 general)
pylons_app/model/forms.py
Show inline comments
 
@@ -92,17 +92,14 @@ class ValidAuth(formencode.validators.Fa
 
              'password':messages['invalid_password']}
 
    e_dict_disable = {'username':messages['disabled_account']}
 
    
 
    def validate_python(self, value, state):
 
        password = value['password']
 
        username = value['username']
 
        try:
 
            user = UserModel().get_user_by_name(username)
 
        except (NoResultFound, MultipleResultsFound, OperationalError) as e:
 
            log.error(e)
 
            user = None
 
        user = UserModel().get_user_by_name(username)
 
        if user is None:
 
            raise formencode.Invalid(self.message('invalid_password',
 
                                     state=State_obj), value, state,
 
                                     error_dict=self.e_dict)            
 
        if user:
 
            if user.active:
 
                if user.username == username and check_password(password, 
0 comments (0 inline, 0 general)