Ignore:
Timestamp:
29 Jun 2012, 17:28:06 (13 years ago)
Author:
Henrik Bettermann
Message:

StudentRequestPasswordPage?: Create mandate and send link by email instead of setting password directly.

Show link to StudentRequestPasswordPage? on login page.

File:
1 edited

Legend:

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

    r8780 r8853  
    6464from waeup.kofa.hostels.hostel import NOT_OCCUPIED
    6565from waeup.kofa.utils.helpers import get_current_principal, to_timezone
     66from waeup.kofa.mandates.mandate import StudentPasswordMandate
    6667
    6768grok.context(IKofaObject) # Make IKofaObject the default context
     
    19831984        kofa_utils = getUtility(IKofaUtils)
    19841985        password = kofa_utils.genPassword()
    1985         IUserAccount(student).setPassword(password)
     1986        mandate = StudentPasswordMandate()
     1987        mandate.params['password'] = password
     1988        mandate.params['student_id'] = student.student_id
     1989        site = grok.getSite()
     1990        site['mandates'].addMandate(mandate)
    19861991        # Send email with credentials
    1987         login_url = self.url(grok.getSite(), 'login')
     1992        args = {'mandate_id':mandate.mandate_id}
     1993        mandate_url = self.url(site) + '/mandate?%s' % urlencode(args)
     1994        url_info = u'Confirmation link: %s' % mandate_url
    19881995        msg = _('You have successfully requested a password for the')
    19891996        if kofa_utils.sendCredentials(IUserAccount(student),
    1990             password, login_url, msg):
     1997            password, url_info, msg):
    19911998            email_sent = student.email
    19921999        else:
Note: See TracChangeset for help on using the changeset viewer.