Changeset 9123


Ignore:
Timestamp:
30 Aug 2012, 06:08:34 (12 years ago)
Author:
Henrik Bettermann
Message:

Display appropriate flash message if credentials are correct
but student has been deactivated/suspended.

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

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r9087 r9123  
    4040    IPrincipalRoleManager, IPrincipalRoleMap)
    4141from zope.session.interfaces import ISession
     42from zope.password.interfaces import IPasswordManager
    4243from waeup.kofa.browser import (
    4344    KofaPage, KofaForm, KofaEditFormPage, KofaAddFormPage,
     
    206207                self.redirect(self.camefrom)
    207208                return
     209            # Display appropriate flash message if credentials are correct
     210            # but student has been deactivated.
     211            login = self.request.form['form.login']
     212            if len(login) == 8 and grok.getSite()['students'].has_key(login):
     213                student = grok.getSite()['students'][
     214                    self.request.form['form.login']]
     215                password = self.request.form['form.password']
     216                passwordmanager = getUtility(IPasswordManager, 'SSHA')
     217                if passwordmanager.checkPassword(student.password, password):
     218                    self.flash(_('Your account has been deactivated.'))
     219                    return
    208220            self.flash(_('You entered invalid credentials.'))
    209221
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r9030 r9123  
    11631163        # and can perform actions
    11641164        IWorkflowInfo(self.student).fireTransition('admit')
    1165         # Students can't login if their account is suspended
     1165        # Students can't login if their account is suspended/deactivated
    11661166        self.student.suspended = True
    11671167        self.browser.open(self.login_path)
     
    11701170        self.browser.getControl("Login").click()
    11711171        self.assertTrue(
    1172             'You entered invalid credentials.' in self.browser.contents)
     1172            'Your account has been deactivated.' in self.browser.contents)
    11731173        self.student.suspended = False
    11741174        self.browser.getControl("Login").click()
Note: See TracChangeset for help on using the changeset viewer.