Changeset 8854 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 29 Jun 2012, 21:22:38 (12 years ago)
- 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 1927 1927 grok.template('requestpw') 1928 1928 form_fields = grok.AutoFields(IStudentRequestPW).select( 1929 'firstname',' reg_number','email')1929 'firstname','number','email') 1930 1930 label = _('Request password for first-time login') 1931 1931 … … 1948 1948 return True 1949 1949 1950 @action(_(' Get login credentials'), style='primary')1950 @action(_('Send login credentials to email address'), style='primary') 1951 1951 def get_credentials(self, **data): 1952 1952 if not self.captcha_result.is_valid: … … 1954 1954 # No need to flash something. 1955 1955 return 1956 reg_number = data.get('reg_number','')1956 number = data.get('number','') 1957 1957 firstname = data.get('firstname','') 1958 1958 cat = getUtility(ICatalog, name='students_catalog') 1959 1959 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))) 1961 1964 if results: 1962 1965 student = results[0] -
main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/requestpw.pt
r8782 r8854 17 17 </table> 18 18 <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! 21 22 </p> 22 23 <div tal:condition="view/availableActions"> -
main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
r8820 r8854 289 289 login for the the first time. 290 290 """ 291 reg_number = schema.TextLine(292 title = u'Registration Number',291 number = schema.TextLine( 292 title = _(u'Registr. or Matric. Number'), 293 293 required = True, 294 294 ) -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r8820 r8854 1894 1894 1895 1895 def test_request_pw(self): 1896 # Student with wrong reg_number can't be found.1896 # Student with wrong number can't be found. 1897 1897 self.browser.open('http://localhost/app/requestpw') 1898 1898 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' 1900 1900 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 1901 self.browser.getControl(" Getlogin credentials").click()1901 self.browser.getControl("Send login credentials").click() 1902 1902 self.assertTrue('No student record found.' 1903 1903 in self.browser.contents) … … 1906 1906 self.browser.open('http://localhost/app/requestpw') 1907 1907 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' 1909 1909 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 1910 self.browser.getControl(" Getlogin credentials").click()1910 self.browser.getControl("Send login credentials").click() 1911 1911 self.assertTrue('No student record found.' 1912 1912 in self.browser.contents) … … 1914 1914 # password has been set and used. 1915 1915 self.browser.getControl(name="form.firstname").value = 'Anna' 1916 self.browser.getControl(name="form. reg_number").value = '123'1917 self.browser.getControl(" Getlogin credentials").click()1916 self.browser.getControl(name="form.number").value = '123' 1917 self.browser.getControl("Send login credentials").click() 1918 1918 self.assertTrue('Your password has already been set and used.' 1919 1919 in self.browser.contents) … … 1922 1922 # The firstname field, used for verification, is not case-sensitive. 1923 1923 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' 1925 1925 self.browser.getControl(name="form.email").value = 'new@yy.zz' 1926 self.browser.getControl(" Getlogin credentials").click()1926 self.browser.getControl("Send login credentials").click() 1927 1927 # 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() 1928 1936 self.assertTrue('Your password request was successful.' 1929 1937 in self.browser.contents)
Note: See TracChangeset for help on using the changeset viewer.