Changeset 15818 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 18 Nov 2019, 09:29:20 (5 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
r15606 r15818 62 62 IPasswordValidator, IContactForm, IKofaUtils, ICSVExporter, 63 63 academic_sessions_vocab, DOCLINK, registration_states_vocab, 64 TRANSREQ, TRANSVAL )64 TRANSREQ, TRANSVAL, NotAnEmailAddress) 65 65 from waeup.kofa.university.faculty import Faculty 66 66 from waeup.kofa.university.department import Department … … 915 915 'in the database.', type='danger') 916 916 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 918 921 919 922 class UserManageFormPage(KofaEditFormPage): … … 2735 2738 grok.require('waeup.Anonymous') 2736 2739 grok.template('changepw') 2737 label = _('Send me a new password')2738 2740 form_fields = grok.AutoFields(IChangePassword) 2739 2741 … … 2750 2752 self.captcha_result = self.captcha.verify(self.request) 2751 2753 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') 2753 2776 2754 2777 def _searchUser(self, identifier, email): -
main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/changepw.pt
r15016 r15818 8 8 </table> 9 9 <br /> 10 <p i18n:translate="email_address_problem"> 10 <p tal:condition="not: view/auto_fill" 11 i18n:translate="email_address_problem"> 11 12 Enter the email address stored in Kofa. 12 13 You can't change your email address here. -
main/waeup.kofa/trunk/src/waeup/kofa/doctests/pages.txt
r15416 r15818 180 180 >>> browser.getControl(name="control_password").value = 'TOP4secret' 181 181 >>> 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 183 We 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... 185 188 ... 186 189 187 190 We can edit user bob: 188 191 192 >>> browser.open('http://localhost/myuniversity/users') 189 193 >>> browser.getControl("Manage", index=0).click() 190 194 >>> browser.getControl("Save", index=0).click()
Note: See TracChangeset for help on using the changeset viewer.