Index: /main/waeup.kofa/trunk/CHANGES.txt
===================================================================
--- /main/waeup.kofa/trunk/CHANGES.txt	(revision 13343)
+++ /main/waeup.kofa/trunk/CHANGES.txt	(revision 13344)
@@ -6,4 +6,6 @@
 
 * Add methods and page to release expired bed allocations.
+
+* Use lastname instead of firstname for first-time password requests.
 
 
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 13343)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 13344)
@@ -2776,5 +2776,5 @@
     grok.template('requestpw')
     form_fields = grok.AutoFields(IStudentRequestPW).select(
-        'firstname','number','email')
+        'lastname','number','email')
     label = _('Request password for first-time login')
 
@@ -2804,5 +2804,5 @@
             return
         number = data.get('number','')
-        firstname = data.get('firstname','')
+        lastname = data.get('lastname','')
         cat = getUtility(ICatalog, name='students_catalog')
         results = list(
@@ -2813,10 +2813,10 @@
         if results:
             student = results[0]
-            if getattr(student,'firstname',None) is None:
+            if getattr(student,'lastname',None) is None:
                 self.flash(_('An error occurred.'), type="danger")
                 return
-            elif student.firstname.lower() != firstname.lower():
+            elif student.lastname.lower() != lastname.lower():
                 # Don't tell the truth here. Anonymous must not
-                # know that a record was found and only the firstname
+                # know that a record was found and only the lastname
                 # verification failed.
                 self.flash(_('No student record found.'), type="warning")
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 13343)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 13344)
@@ -3231,5 +3231,5 @@
         # Student with wrong number can't be found.
         self.browser.open('http://localhost/app/requestpw')
-        self.browser.getControl(name="form.firstname").value = 'Anna'
+        self.browser.getControl(name="form.lastname").value = 'Tester'
         self.browser.getControl(name="form.number").value = 'anynumber'
         self.browser.getControl(name="form.email").value = 'xx@yy.zz'
@@ -3237,8 +3237,8 @@
         self.assertTrue('No student record found.'
             in self.browser.contents)
-        # Anonymous is not informed that firstname verification failed.
+        # Anonymous is not informed that lastname verification failed.
         # It seems that the record doesn't exist.
         self.browser.open('http://localhost/app/requestpw')
-        self.browser.getControl(name="form.firstname").value = 'Johnny'
+        self.browser.getControl(name="form.lastname").value = 'Johnny'
         self.browser.getControl(name="form.number").value = '123'
         self.browser.getControl(name="form.email").value = 'xx@yy.zz'
@@ -3246,7 +3246,7 @@
         self.assertTrue('No student record found.'
             in self.browser.contents)
-        # Even with the correct firstname we can't register if a
+        # Even with the correct lastname we can't register if a
         # password has been set and used.
-        self.browser.getControl(name="form.firstname").value = 'Anna'
+        self.browser.getControl(name="form.lastname").value = 'Tester'
         self.browser.getControl(name="form.number").value = '123'
         self.browser.getControl("Send login credentials").click()
@@ -3255,6 +3255,6 @@
         self.browser.open('http://localhost/app/requestpw')
         self.app['students'][self.student_id].password = None
-        # The firstname field, used for verification, is not case-sensitive.
-        self.browser.getControl(name="form.firstname").value = 'aNNa'
+        # The lastname field, used for verification, is not case-sensitive.
+        self.browser.getControl(name="form.lastname").value = 'tESTer'
         self.browser.getControl(name="form.number").value = '123'
         self.browser.getControl(name="form.email").value = 'new@yy.zz'
@@ -3265,5 +3265,5 @@
         # We can also use the matric_number instead.
         self.browser.open('http://localhost/app/requestpw')
-        self.browser.getControl(name="form.firstname").value = 'aNNa'
+        self.browser.getControl(name="form.lastname").value = 'tESTer'
         self.browser.getControl(name="form.number").value = '234'
         self.browser.getControl(name="form.email").value = 'new@yy.zz'
