Changeset - 40bccabf4574
[Not reviewed]
default
0 2 0
Marcin Kuzminski - 15 years ago 2010-07-14 15:42:39
marcin@python-works.com
fixed bug for user update, when password was always set.
2 files changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
pylons_app/model/forms.py
Show inline comments
 
@@ -58,13 +58,14 @@ class ValidUsername(formencode.validator
 
        if value in ['default', 'new_user']:
 
            raise formencode.Invalid(_('Invalid username'), value, state)
 
    
 
class ValidPassword(formencode.validators.FancyValidator):
 
    
 
    def to_python(self, value, state):
 
        return get_crypt_password(value)
 
        if value:
 
            return get_crypt_password(value)
 
        
 
class ValidAuth(formencode.validators.FancyValidator):
 
    messages = {
 
            'invalid_password':_('invalid password'),
 
            'invalid_login':_('invalid user name'),
 
            'disabled_account':_('Your acccount is disabled')
pylons_app/model/user_model.py
Show inline comments
 
@@ -59,13 +59,12 @@ class UserModel(object):
 
            if new_user.username == 'default':
 
                raise DefaultUserException(
 
                                _("You can't Edit this user since it's" 
 
                                  " crucial for entire application"))
 
            for k, v in form_data.items():
 
                if k == 'new_password' and v != '':
 
                    
 
                    new_user.password = v
 
                else:
 
                    setattr(new_user, k, v)
 
                
 
            self.sa.add(new_user)
 
            self.sa.commit()
0 comments (0 inline, 0 general)