Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6703)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/browser.py	(revision 6704)
@@ -156,5 +156,5 @@
         self.reg_number = self.request.form.get('form.reg_number', None)
         # We must not use form.ac_series and form.ac_number in forms since these
-        # are interpreted by applicant credentials
+        # are interpreted as applicant credentials in the applicants package
         self.acseries = self.request.form.get('form.acseries', None)
         self.acnumber = self.request.form.get('form.acnumber', None)
@@ -170,9 +170,7 @@
             self.flash('More than one student found.')
             return
-        self.student_id = hitlist[0].student_id
-        student_pw = hitlist[0].context.password
-        if student_pw:
-            self.flash('Password has already been set. Please request a password reset.')
-            return
+        student = hitlist[0].context
+        self.student_id = student.student_id
+        student_pw = student.password
         pin = '%s-%s-%s' % (self.acprefix,self.acseries,self.acnumber)
         code = get_access_code(pin)
@@ -180,4 +178,11 @@
             self.flash('Access code is invalid.')
             return
+        if student_pw and pin == student.adm_code:
+            self.flash('Password has already been set. Your Student Id is %s'
+                % self.student_id)
+            return
+        elif student_pw:
+            self.flash('Password has already been set.')
+            return
         # Mark pin as used (this also fires a pin related transition)
         # and set student password
@@ -186,10 +191,12 @@
             return
         else:
-            comment = u"AC invalidated"
+            comment = u"AC invalidated for %s" % self.student_id
             # Here we know that the ac is in state initialized so we do not
             # expect an exception
             #import pdb; pdb.set_trace()
             invalidate_accesscode(pin,comment)
-            IUserAccount(hitlist[0].context).setPassword(self.acnumber)
+            IUserAccount(student).setPassword(self.acnumber)
+        self.flash('Password has been set. Your Student Id is %s'
+            % self.student_id)
         return
 
Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py	(revision 6703)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/interfaces.py	(revision 6704)
@@ -63,4 +63,5 @@
     #student_id = Attribute('Randomly generated id')
     password = Attribute('Encrypted password of a student')
+    adm_code = Attribute('Admission checking access code')
 
     def loggerInfo(ob_class, comment):
Index: /main/waeup.sirp/trunk/src/waeup/sirp/students/student.py
===================================================================
--- /main/waeup.sirp/trunk/src/waeup/sirp/students/student.py	(revision 6703)
+++ /main/waeup.sirp/trunk/src/waeup/sirp/students/student.py	(revision 6704)
@@ -46,4 +46,5 @@
             self.student_id = u'Z654321'
         self.password = None
+        self.adm_code = None
         return
 
