Ignore:
Timestamp:
14 Oct 2012, 21:02:31 (12 years ago)
Author:
Henrik Bettermann
Message:

Dedicated officers should be able to login as student with a temporary password set by the system. This is the first part of its implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/authentication.py

    r8983 r9334  
    101101
    102102    def checkPassword(self, password):
    103         """Check whether the given `password` matches the one stored.
     103        """Check whether the given `password` matches the one stored by
     104        students or the temporary password set by officers.
    104105
    105106        We additionally check if student account has been suspended.
     
    107108        if not isinstance(password, basestring):
    108109            return False
     110        passwordmanager = getUtility(IPasswordManager, 'SSHA')
     111        temp_password = self.context.getTempPassword()
     112        if temp_password:
     113            return passwordmanager.checkPassword(temp_password, password)
    109114        if not getattr(self.context, 'password', None):
    110115            # unset/empty passwords do never match
     
    112117        if self.context.suspended == True:
    113118            return False
    114         passwordmanager = getUtility(IPasswordManager, 'SSHA')
    115         return passwordmanager.checkPassword(
    116             self.context.password, password)
     119        return passwordmanager.checkPassword(self.context.password, password)
    117120
    118121class StudentsAuthenticatorPlugin(grok.GlobalUtility):
Note: See TracChangeset for help on using the changeset viewer.