Ignore:
Timestamp:
18 Sep 2011, 00:26:48 (13 years ago)
Author:
uli
Message:

Make password setting a bit better readable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py

    r6789 r6790  
    343343        form = self.request.form
    344344        ob_class = self.__implemented__.__name__.replace('waeup.sirp.','')
    345         if form.has_key('password') and form['password']:
    346             if form['password'] != form['control_password']:
     345        password = form.get('password', None)
     346        password_ctl = form.get('control_password', None)
     347        if password:
     348            if (password != password_ctl):
    347349                self.flash('Passwords do not match.')
    348                 return
    349             IUserAccount(self.context).setPassword(form['password'])
    350             self.context.loggerInfo(ob_class, 'password changed')
     350            else:
     351                # XXX: This is too early. PW should only be saved if there
     352                #      are no (other) errors left in form.
     353                IUserAccount(self.context).setPassword(password)
     354                self.context.loggerInfo(ob_class, 'password changed')
     355
    351356        #self.reg_number = form.get('form.reg_number', None)
    352357        #if self.reg_number:
Note: See TracChangeset for help on using the changeset viewer.