Ignore:
Timestamp:
29 Jun 2012, 17:28:06 (12 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.

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

Legend:

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

    r8742 r8853  
    10831083        # Send email with credentials
    10841084        login_url = self.url(grok.getSite(), 'login')
     1085        url_info = u'Login: %s' % login_url
    10851086        msg = _('You have successfully been registered for the')
    10861087        if kofa_utils.sendCredentials(IUserAccount(applicant),
    1087             password, login_url, msg):
     1088            password, url_info, msg):
    10881089            email_sent = applicant.email
    10891090        else:
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r8783 r8853  
    21292129        msg = _('You have successfully changed your password for the')
    21302130        login_url = self.url(grok.getSite(), 'login')
     2131        url_info = u'Login: %s' % login_url
    21312132        success = kofa_utils.sendCredentials(
    2132             IUserAccount(user),pwd,login_url,msg)
     2133            IUserAccount(user),pwd,url_info,msg)
    21332134        if success:
    21342135            self.flash(_('An email with your user name and password ' +
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/loginpage.pt

    r8777 r8853  
    3737    If you are having trouble logging in, make sure to enable  cookies in your web browser.
    3838  </p>
    39   <p i18n:translate="login_trouble2">
     39  <p i18n:translate="login_trouble2" tal:condition="python:False">
    4040    You don't have an account because you are a fresh student, or your student record has just been created?
    41     Acquire a Password Access Code (PWD) and inititialize your student account
    42     <strong><a href  ="setpassword"> here</a></strong>.
     41    Acquire a Password Activation Code (PWD) and inititialize your student account
     42    <strong><a href ="setpassword"> here</a></strong>.
     43  </p>
     44  <p i18n:translate="login_trouble4">
     45    You don't have an account because you are a fresh student, or your student record has just been created?
     46    Inititialize your student account <strong><a href="requestpw"> here</a></strong>.
    4347  </p>
    4448  <p i18n:translate="login_trouble3"> Or simply forgot your student id, application id or password? Then request a new password
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r8759 r8853  
    234234        """
    235235
    236     def sendCredentials(user, password, login_url, msg):
     236    def sendCredentials(user, password, url_info, msg):
    237237        """Send credentials as email.
    238238
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py

    r8849 r8853  
    6868            msg = _('Mandate expired.')
    6969        if self._setStudentPassword():
    70             msg = _('Password has been successfully set.')
     70            msg = _('Password has been successfully set. '
     71                    'Proceed to the login page and enter your credentials.')
    7172        del self.__parent__[self.mandate_id]
    7273        return msg
  • main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py

    r8850 r8853  
    104104        msg = mandate.execute()
    105105        # Password has been set.
    106         self.assertEqual(msg, u'Password has been successfully set.')
     106        self.assertEqual(msg, 'Password has been successfully set. Proceed to '
     107            'the login page and enter your credentials.')
    107108        self.assertTrue(IUserAccount(student).checkPassword('mypwd1'))
    108109        # All mandates have been removed.
     
    132133            % mandate.mandate_id)
    133134        # Password has been set.
    134         self.assertTrue('Password has been successfully set.'
     135        self.assertTrue('Password has been successfully set. Proceed to '
     136                        'the login page and enter your credentials.'
    135137            in self.browser.contents)
    136138        self.assertTrue(IUserAccount(student).checkPassword('mypwd1'))
  • 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:
  • main/waeup.kofa/trunk/src/waeup/kofa/utils/utils.py

    r8603 r8853  
    192192
    193193
    194     def sendCredentials(self, user, password=None, login_url=None, msg=None):
     194    def sendCredentials(self, user, password=None, url_info=None, msg=None):
    195195        """Send credentials as email.
    196196
     
    209209Your user name: ${d}
    210210Your password: ${e}
    211 Login page: ${f}
     211${f}
    212212
    213213Please remember your user name and keep
     
    230230            'd':user.name,
    231231            'e':password,
    232             'f':login_url})
     232            'f':url_info})
    233233
    234234        body = translate(text, 'waeup.kofa',
Note: See TracChangeset for help on using the changeset viewer.