Changeset 8039 for main


Ignore:
Timestamp:
4 Apr 2012, 11:25:41 (13 years ago)
Author:
Henrik Bettermann
Message:

Use ChangePasswordRequestPage? also for applicants.

Change password requests require a registration number.

Location:
main/waeup.kofa/trunk/src/waeup/kofa
Files:
7 edited
1 moved

Legend:

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

    r7819 r8039  
    163163    applicant_id = index.Field(attribute='applicant_id')
    164164    reg_number = index.Field(attribute='reg_number')
     165    email = index.Field(attribute='email')
    165166
    166167class ApplicantFactory(grok.GlobalUtility):
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/browser.py

    r8037 r8039  
    745745    form_fields = grok.AutoFields(IApplicantEdit).omit(
    746746        'locked', 'course_admitted', 'student_id',
    747         'screening_score', 'reg_number'
     747        'screening_score',
    748748        )
    749749    form_fields['date_of_birth'].custom_widget = FriendlyDateWidget('le-year')
    750750    form_fields['phone'].custom_widget = PhoneWidget
    751751    form_fields['applicant_id'].for_display = True
     752    form_fields['reg_number'].for_display = True
    752753    grok.template('applicanteditpage')
    753754    manage_applications = False
     
    917918                if applicant.password is not None:
    918919                    self.flash(_('Your password has already been set. '
    919                                   'You can proceed to the login page.'))
     920                                  'Please proceed to the login page.'))
    920921                    return
    921922                elif getattr(applicant,'firstname',None) is None:
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py

    r8037 r8039  
    2121import shutil
    2222import tempfile
     23import grok
    2324from StringIO import StringIO
    2425from datetime import datetime, date, timedelta
    2526from mechanize import LinkNotFoundError
     27from zope.event import notify
    2628from zope.component import createObject, getUtility
    2729from zope.component.hooks import setSite, clearSite
     
    866868            self.container_path + '/registration_complete?email=xx%40yy.zz')
    867869        return
     870
     871    def test_change_password_request(self):
     872        self.browser.open('http://localhost/app/sendpw')
     873        self.browser.getControl(name="form.reg_number").value = '1234'
     874        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
     875        self.browser.getControl("Get new login credentials").click()
     876        self.assertTrue('No record found' in self.browser.contents)
     877        self.applicant.email = 'aa@aa.ng'
     878        # Update the catalog
     879        notify(grok.ObjectModifiedEvent(self.applicant))
     880        self.browser.open('http://localhost/app/sendpw')
     881        self.browser.getControl(name="form.reg_number").value = '1234'
     882        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
     883        self.browser.getControl("Get new login credentials").click()
     884        self.assertTrue(
     885            'An email with your user name and password has been sent'
     886            in self.browser.contents)
  • main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/loginpage.pt

    r7811 r8039  
    4242    <strong><a href  ="setpassword"> here</a></strong>.
    4343  </p>
    44   <p i18n:translate="login_trouble3"> Or simply forgot your student id or password? Then request a new password
    45     <strong><a href="changepw"> here</a></strong>.
     44  <p i18n:translate="login_trouble3"> Or simply forgot your student id, application id or password? Then request a new password
     45    <strong><a href="sendpw"> here</a></strong>.
    4646  </p>
    4747</form>
  • main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py

    r7933 r8039  
    325325
    326326    mode = schema.Choice(
    327         title = _(u'Import mode'),
     327        title = _(u'Import Mode'),
    328328        values = ['create', 'update', 'remove']
    329329        )
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r7997 r8039  
    18511851    """
    18521852    grok.context(IUniversity)
    1853     grok.name('changepw')
     1853    grok.name('sendpw')
    18541854    grok.require('waeup.Anonymous')
    1855     grok.template('changepw')
    1856     label = _('Change my password')
     1855    grok.template('sendpassword')
     1856    label = _('Send me a new password')
    18571857    form_fields = grok.AutoFields(IStudentChangePassword)
    18581858
     
    18701870            # No need to flash something.
    18711871            return
    1872         # Search student
    1873         cat = queryUtility(ICatalog, name='students_catalog')
     1872        # Search student or applicant
    18741873        reg_number = data['reg_number']
    18751874        email = data['email']
     1875        cat = queryUtility(ICatalog, name='students_catalog')
    18761876        results = cat.searchResults(
    18771877            reg_number=(reg_number, reg_number),
    18781878            email=(email,email))
    18791879        if len(results) == 0:
    1880             self.flash(_('No student record found.'))
     1880            # Try also the applicants_catalog if no student record was found.
     1881            cat = queryUtility(ICatalog, name='applicants_catalog')
     1882            if cat is None:
     1883                self.flash(_('Application package not installed.'))
     1884                return
     1885            results = cat.searchResults(
     1886                reg_number=(reg_number, reg_number),
     1887                email=(email,email))
     1888        if len(results) == 0:
     1889            self.flash(_('No record found.'))
    18811890            return
    18821891        student = list(results)[0]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/sendpassword.pt

    r8025 r8039  
    1717  </table>
    1818
     19  <p i18n:translate="email_address_problem">
     20    Enter the email address stored on Kofa.
     21    You can't change your email address here.
     22    If you've forgotten your email address or the email
     23    address stored in Kofa is wrong or no longer valid,
     24    use the enquiries form to request a change
     25    of address.
     26  </p>
     27  <br />
    1928  <div tal:condition="view/availableActions">
    2029    <input tal:repeat="action view/actions"
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r7997 r8039  
    16431643
    16441644    def test_change_password_request(self):
    1645         self.browser.open('http://localhost/app/changepw')
     1645        self.browser.open('http://localhost/app/sendpw')
    16461646        self.browser.getControl(name="form.reg_number").value = '123'
    16471647        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
Note: See TracChangeset for help on using the changeset viewer.