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.

File:
1 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
Note: See TracChangeset for help on using the changeset viewer.