Changeset 8854 for main/waeup.kofa/trunk


Ignore:
Timestamp:
29 Jun 2012, 21:22:38 (12 years ago)
Author:
Henrik Bettermann
Message:

Returning students do not necessarily have a registration number and can use their matric. number instead.

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

Legend:

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

    r8853 r8854  
    19271927    grok.template('requestpw')
    19281928    form_fields = grok.AutoFields(IStudentRequestPW).select(
    1929         'firstname','reg_number','email')
     1929        'firstname','number','email')
    19301930    label = _('Request password for first-time login')
    19311931
     
    19481948        return True
    19491949
    1950     @action(_('Get login credentials'), style='primary')
     1950    @action(_('Send login credentials to email address'), style='primary')
    19511951    def get_credentials(self, **data):
    19521952        if not self.captcha_result.is_valid:
     
    19541954            # No need to flash something.
    19551955            return
    1956         reg_number = data.get('reg_number','')
     1956        number = data.get('number','')
    19571957        firstname = data.get('firstname','')
    19581958        cat = getUtility(ICatalog, name='students_catalog')
    19591959        results = list(
    1960             cat.searchResults(reg_number=(reg_number, reg_number)))
     1960            cat.searchResults(reg_number=(number, number)))
     1961        if not results:
     1962            results = list(
     1963                cat.searchResults(matric_number=(number, number)))
    19611964        if results:
    19621965            student = results[0]
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/requestpw.pt

    r8782 r8854  
    1717  </table>
    1818  <p i18n:translate="">
    19     Your student record will be looked up and an email with your login
    20     credentials will be sent to the address provided.
     19    Your student record will be looked up and
     20    your login credentials will be sent to the email address given above.
     21    To be able to proceed you must provide a valid email address!
    2122  </p>
    2223  <div tal:condition="view/availableActions">
  • main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py

    r8820 r8854  
    289289    login for the the first time.
    290290    """
    291     reg_number = schema.TextLine(
    292         title = u'Registration Number',
     291    number = schema.TextLine(
     292        title = _(u'Registr. or Matric. Number'),
    293293        required = True,
    294294        )
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r8820 r8854  
    18941894
    18951895    def test_request_pw(self):
    1896         # Student with wrong reg_number can't be found.
     1896        # Student with wrong number can't be found.
    18971897        self.browser.open('http://localhost/app/requestpw')
    18981898        self.browser.getControl(name="form.firstname").value = 'Anna'
    1899         self.browser.getControl(name="form.reg_number").value = 'anynumber'
     1899        self.browser.getControl(name="form.number").value = 'anynumber'
    19001900        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    1901         self.browser.getControl("Get login credentials").click()
     1901        self.browser.getControl("Send login credentials").click()
    19021902        self.assertTrue('No student record found.'
    19031903            in self.browser.contents)
     
    19061906        self.browser.open('http://localhost/app/requestpw')
    19071907        self.browser.getControl(name="form.firstname").value = 'Johnny'
    1908         self.browser.getControl(name="form.reg_number").value = '123'
     1908        self.browser.getControl(name="form.number").value = '123'
    19091909        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
    1910         self.browser.getControl("Get login credentials").click()
     1910        self.browser.getControl("Send login credentials").click()
    19111911        self.assertTrue('No student record found.'
    19121912            in self.browser.contents)
     
    19141914        # password has been set and used.
    19151915        self.browser.getControl(name="form.firstname").value = 'Anna'
    1916         self.browser.getControl(name="form.reg_number").value = '123'
    1917         self.browser.getControl("Get login credentials").click()
     1916        self.browser.getControl(name="form.number").value = '123'
     1917        self.browser.getControl("Send login credentials").click()
    19181918        self.assertTrue('Your password has already been set and used.'
    19191919            in self.browser.contents)
     
    19221922        # The firstname field, used for verification, is not case-sensitive.
    19231923        self.browser.getControl(name="form.firstname").value = 'aNNa'
    1924         self.browser.getControl(name="form.reg_number").value = '123'
     1924        self.browser.getControl(name="form.number").value = '123'
    19251925        self.browser.getControl(name="form.email").value = 'new@yy.zz'
    1926         self.browser.getControl("Get login credentials").click()
     1926        self.browser.getControl("Send login credentials").click()
    19271927        # Yeah, we succeded ...
     1928        self.assertTrue('Your password request was successful.'
     1929            in self.browser.contents)
     1930        # We can also use the matric_number instead.
     1931        self.browser.open('http://localhost/app/requestpw')
     1932        self.browser.getControl(name="form.firstname").value = 'aNNa'
     1933        self.browser.getControl(name="form.number").value = '234'
     1934        self.browser.getControl(name="form.email").value = 'new@yy.zz'
     1935        self.browser.getControl("Send login credentials").click()
    19281936        self.assertTrue('Your password request was successful.'
    19291937            in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.