Changeset 15818 for main


Ignore:
Timestamp:
18 Nov 2019, 09:29:20 (5 years ago)
Author:
Henrik Bettermann
Message:

Redirect to ChangePasswordRequestPage after successfully adding an officer.

Location:
main/waeup.kofa/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/CHANGES.txt

    r15798 r15818  
    441.6.1.dev0 (unreleased)
    55=======================
     6
     7* Redirect to `ChangePasswordRequestPage` after successfully
     8  adding an officer.
    69
    710* Add get_bursary_data webservice.
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py

    r15606 r15818  
    6262    IPasswordValidator, IContactForm, IKofaUtils, ICSVExporter,
    6363    academic_sessions_vocab, DOCLINK, registration_states_vocab,
    64     TRANSREQ, TRANSVAL)
     64    TRANSREQ, TRANSVAL, NotAnEmailAddress)
    6565from waeup.kofa.university.faculty import Faculty
    6666from waeup.kofa.university.department import Department
     
    915915                                  'in the database.', type='danger')
    916916            return
    917         self.redirect(self.url(self.context))
     917        #self.redirect(self.url(self.context))
     918        args = {'identifier':name, 'email':email}
     919        self.redirect(self.application_url() + '/changepw?%s' % urlencode(args))
     920        return
    918921
    919922class UserManageFormPage(KofaEditFormPage):
     
    27352738    grok.require('waeup.Anonymous')
    27362739    grok.template('changepw')
    2737     label = _('Send me a new password')
    27382740    form_fields = grok.AutoFields(IChangePassword)
    27392741
     
    27502752        self.captcha_result = self.captcha.verify(self.request)
    27512753        self.captcha_code = self.captcha.display(self.captcha_result.error_code)
    2752         return
     2754        # Unset default values maybe set by another person who used this form.
     2755        self.form_fields.get('identifier').field.default = None
     2756        self.form_fields.get('email').field.default = None
     2757        self.auto_fill = False
     2758        # If the form is used with url encoded form parameters.
     2759        form = self.request.form
     2760        if form.get('identifier') and form.get('email'):
     2761            try:
     2762                self.form_fields.get('identifier').field.default = form.get('identifier')
     2763                self.form_fields.get('email').field.default = str(form.get('email'))
     2764            except NotAnEmailAddress:
     2765                self.flash(_('This is not a valid email address.'),
     2766                       type='danger')
     2767                self.redirect(self.url(self.context))
     2768                return
     2769            self.auto_fill = True
     2770        return
     2771
     2772    def label(self):
     2773        if self.auto_fill:
     2774            return _('Send user a new password')
     2775        return _('Send me a new password')
    27532776
    27542777    def _searchUser(self, identifier, email):
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/changepw.pt

    r15016 r15818  
    88  </table>
    99  <br />
    10   <p i18n:translate="email_address_problem">
     10  <p tal:condition="not: view/auto_fill"
     11     i18n:translate="email_address_problem">
    1112    Enter the email address stored in Kofa.
    1213    You can't change your email address here.
  • main/waeup.kofa/trunk/src/waeup/kofa/doctests/pages.txt

    r15416 r15818  
    180180  >>> browser.getControl(name="control_password").value = 'TOP4secret'
    181181  >>> browser.getControl("Add officer").click()
    182   >>> print browser.contents
    183   <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
    184   ...<td>bob</td>
     182
     183We have been redirected to the Send Password page:
     184
     185  >>> print browser.contents
     186  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
     187  ...Send user a new password...
    185188  ...
    186189
    187190We can edit user bob:
    188191
     192  >>> browser.open('http://localhost/myuniversity/users')
    189193  >>> browser.getControl("Manage", index=0).click()
    190194  >>> browser.getControl("Save", index=0).click()
Note: See TracChangeset for help on using the changeset viewer.