Ignore:
Timestamp:
24 Jun 2016, 06:48:18 (8 years ago)
Author:
Henrik Bettermann
Message:

Do not set password if mandate has expired.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/mandates
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py

    r13986 r13987  
    7070        if self.expires < datetime.utcnow():
    7171            msg = _('Mandate expired.')
    72         if self._setPassword():
     72        elif self._setPassword():
    7373            msg = _('Password has been successfully set. '
    7474                    'Login with your new password.')
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py

    r13986 r13987  
    8989        # Add and execute a mandate with missing parameters.
    9090        mandate = PasswordMandate()
     91        IUserAccount(student).setPassword('old_pw')
    9192        self.app['mandates'].addMandate(mandate)
    9293        (msg, redirect_path) = mandate.execute()
     
    9596        # Add and execute an expired mandate.
    9697        mandate = PasswordMandate(days=0)
     98        mandate.params['user'] = student
     99        mandate.params['password'] = 'mypwd1'
    97100        self.app['mandates'].addMandate(mandate)
    98101        (msg, redirect_path) = mandate.execute()
    99102        self.assertEqual(msg, u'Mandate expired.')
    100103        self.assertEqual(redirect_path, '')
     104        # Password has not been set
     105        self.assertTrue(IUserAccount(student).checkPassword('old_pw'))
    101106        # Add and execute a perfect mandate
    102107        mandate = PasswordMandate()
Note: See TracChangeset for help on using the changeset viewer.