Ignore:
Timestamp:
23 Oct 2015, 06:41:21 (9 years ago)
Author:
Henrik Bettermann
Message:

Use lastname instead of firstname for first-time password requests.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

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

    r13247 r13344  
    27762776    grok.template('requestpw')
    27772777    form_fields = grok.AutoFields(IStudentRequestPW).select(
    2778         'firstname','number','email')
     2778        'lastname','number','email')
    27792779    label = _('Request password for first-time login')
    27802780
     
    28042804            return
    28052805        number = data.get('number','')
    2806         firstname = data.get('firstname','')
     2806        lastname = data.get('lastname','')
    28072807        cat = getUtility(ICatalog, name='students_catalog')
    28082808        results = list(
     
    28132813        if results:
    28142814            student = results[0]
    2815             if getattr(student,'firstname',None) is None:
     2815            if getattr(student,'lastname',None) is None:
    28162816                self.flash(_('An error occurred.'), type="danger")
    28172817                return
    2818             elif student.firstname.lower() != firstname.lower():
     2818            elif student.lastname.lower() != lastname.lower():
    28192819                # Don't tell the truth here. Anonymous must not
    2820                 # know that a record was found and only the firstname
     2820                # know that a record was found and only the lastname
    28212821                # verification failed.
    28222822                self.flash(_('No student record found.'), type="warning")
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r13314 r13344  
    32313231        # Student with wrong number can't be found.
    32323232        self.browser.open('http://localhost/app/requestpw')
    3233         self.browser.getControl(name="form.firstname").value = 'Anna'
     3233        self.browser.getControl(name="form.lastname").value = 'Tester'
    32343234        self.browser.getControl(name="form.number").value = 'anynumber'
    32353235        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     
    32373237        self.assertTrue('No student record found.'
    32383238            in self.browser.contents)
    3239         # Anonymous is not informed that firstname verification failed.
     3239        # Anonymous is not informed that lastname verification failed.
    32403240        # It seems that the record doesn't exist.
    32413241        self.browser.open('http://localhost/app/requestpw')
    3242         self.browser.getControl(name="form.firstname").value = 'Johnny'
     3242        self.browser.getControl(name="form.lastname").value = 'Johnny'
    32433243        self.browser.getControl(name="form.number").value = '123'
    32443244        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     
    32463246        self.assertTrue('No student record found.'
    32473247            in self.browser.contents)
    3248         # Even with the correct firstname we can't register if a
     3248        # Even with the correct lastname we can't register if a
    32493249        # password has been set and used.
    3250         self.browser.getControl(name="form.firstname").value = 'Anna'
     3250        self.browser.getControl(name="form.lastname").value = 'Tester'
    32513251        self.browser.getControl(name="form.number").value = '123'
    32523252        self.browser.getControl("Send login credentials").click()
     
    32553255        self.browser.open('http://localhost/app/requestpw')
    32563256        self.app['students'][self.student_id].password = None
    3257         # The firstname field, used for verification, is not case-sensitive.
    3258         self.browser.getControl(name="form.firstname").value = 'aNNa'
     3257        # The lastname field, used for verification, is not case-sensitive.
     3258        self.browser.getControl(name="form.lastname").value = 'tESTer'
    32593259        self.browser.getControl(name="form.number").value = '123'
    32603260        self.browser.getControl(name="form.email").value = 'new@yy.zz'
     
    32653265        # We can also use the matric_number instead.
    32663266        self.browser.open('http://localhost/app/requestpw')
    3267         self.browser.getControl(name="form.firstname").value = 'aNNa'
     3267        self.browser.getControl(name="form.lastname").value = 'tESTer'
    32683268        self.browser.getControl(name="form.number").value = '234'
    32693269        self.browser.getControl(name="form.email").value = 'new@yy.zz'
Note: See TracChangeset for help on using the changeset viewer.