Index: /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 8345)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_browser.py	(revision 8346)
@@ -869,7 +869,7 @@
     def test_change_password_request(self):
         self.browser.open('http://localhost/app/sendpw')
-        self.browser.getControl(name="form.reg_number").value = '1234'
+        self.browser.getControl(name="form.identifier").value = '1234'
         self.browser.getControl(name="form.email").value = 'aa@aa.ng'
-        self.browser.getControl("Get new login credentials").click()
+        self.browser.getControl("Get login credentials").click()
         self.assertTrue('No record found' in self.browser.contents)
         self.applicant.email = 'aa@aa.ng'
@@ -877,7 +877,7 @@
         notify(grok.ObjectModifiedEvent(self.applicant))
         self.browser.open('http://localhost/app/sendpw')
-        self.browser.getControl(name="form.reg_number").value = '1234'
+        self.browser.getControl(name="form.identifier").value = '1234'
         self.browser.getControl(name="form.email").value = 'aa@aa.ng'
-        self.browser.getControl("Get new login credentials").click()
+        self.browser.getControl("Get login credentials").click()
         self.assertTrue(
             'An email with your user name and password has been sent'
Index: /main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py	(revision 8345)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/browser/pages.py	(revision 8346)
@@ -45,5 +45,6 @@
     IUniversity, IFacultiesContainer, IFaculty, IFacultyAdd,
     IDepartment, IDepartmentAdd, ICourse, ICourseAdd, ICertificate,
-    ICertificateAdd, ICertificateCourse, ICertificateCourseAdd)
+    ICertificateAdd, ICertificateCourse, ICertificateCourseAdd,
+    ICaptchaManager)
 from waeup.kofa.browser.layout import jsaction, action, UtilityView
 from waeup.kofa.browser.resources import warning, datepicker, tabs, datatable
@@ -54,5 +55,6 @@
     ILocalRolesAssignable, DuplicationError, IConfigurationContainer,
     ISessionConfiguration, ISessionConfigurationAdd,
-    IPasswordValidator, IContactForm, IKofaUtils, ICSVExporter)
+    IPasswordValidator, IContactForm, IKofaUtils, ICSVExporter,
+    IChangePassword)
 from waeup.kofa.permissions import get_users_with_local_roles, get_all_roles
 from waeup.kofa.students.catalog import search as searchstudents
@@ -1957,2 +1959,74 @@
         return
 
+class ChangePasswordRequestPage(KofaForm):
+    """Captcha'd page for all kind of users to request a password change.
+    """
+    grok.context(IUniversity)
+    grok.name('sendpw')
+    grok.require('waeup.Anonymous')
+    grok.template('sendpassword')
+    label = _('Send me a new password')
+    form_fields = grok.AutoFields(IChangePassword)
+
+    def update(self):
+        # Handle captcha
+        self.captcha = getUtility(ICaptchaManager).getCaptcha()
+        self.captcha_result = self.captcha.verify(self.request)
+        self.captcha_code = self.captcha.display(self.captcha_result.error_code)
+        return
+
+    def _searchUser(self, identifier, email):
+        # Search student
+        cat = queryUtility(ICatalog, name='students_catalog')
+        results = cat.searchResults(
+            #reg_number=(identifier, identifier),
+            email=(email,email))
+        for result in results:
+            if result.student_id == identifier or \
+                result.reg_number == identifier or \
+                result.matric_number == identifier:
+                return result
+        # Search applicant
+        cat = queryUtility(ICatalog, name='applicants_catalog')
+        if cat is not None:
+            results = cat.searchResults(
+                #reg_number=(identifier, identifier),
+                email=(email,email))
+            for result in results:
+                if result.applicant_id == identifier or \
+                    result.reg_number == identifier:
+                    return result
+        # Search portal user
+        user = grok.getSite()['users'].get(identifier, None)
+        if user is not None and user.email == email:
+            return user
+        return None
+
+    @action(_('Get login credentials'), style='primary')
+    def request(self, **data):
+        if not self.captcha_result.is_valid:
+            # Captcha will display error messages automatically.
+            # No need to flash something.
+            return
+        # Search student or applicant
+        identifier = data['identifier']
+        email = data['email']
+        user = self._searchUser(identifier, email)
+        if user is None:
+            self.flash(_('No record found.'))
+            return
+        # Change password
+        kofa_utils = getUtility(IKofaUtils)
+        pwd = kofa_utils.genPassword()
+        IUserAccount(user).setPassword(pwd)
+        # Send email with new redentials
+        msg = _('You have successfully changed your password for the')
+        login_url = self.url(grok.getSite(), 'login')
+        success = kofa_utils.sendCredentials(
+            IUserAccount(user),pwd,login_url,msg)
+        if success:
+            self.flash(_('An email with your user name and password ' +
+                'has been sent to ${a}.', mapping = {'a':email}))
+        else:
+            self.flash(_('An smtp server error occurred.'))
+        return
Index: /main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/sendpassword.pt
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/sendpassword.pt	(revision 8346)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/browser/templates/sendpassword.pt	(revision 8346)
@@ -0,0 +1,33 @@
+<form action="." tal:attributes="action request/URL" method="post"
+      i18n:domain="waeup.kofa" enctype="multipart/form-data">
+
+  <table class="form-table">
+    <tbody>
+      <tal:widgets content="structure provider:widgets" />
+      <tr tal:condition="view/captcha_code">
+        <td i18n:translate="solve_captcha">
+          Please solve the captcha<br />to prevent misuse of this service:
+        </td>
+        <td>
+          <div tal:content="structure view/captcha_code"></div>
+        </td>
+      </tr>
+
+    </tbody>
+  </table>
+
+  <p i18n:translate="email_address_problem">
+    Enter the email address stored in Kofa.
+    You can't change your email address here.
+    If you've forgotten your email address or the email
+    address stored in Kofa is wrong or no longer valid,
+    use the enquiries form to request a change
+    of address.
+  </p>
+  <br />
+  <div tal:condition="view/availableActions">
+    <input tal:repeat="action view/actions"
+           tal:replace="structure action/render"
+           />
+  </div>
+</form>
Index: /main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py	(revision 8345)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/interfaces.py	(revision 8346)
@@ -1043,2 +1043,19 @@
         required = True,
         )
+
+class IChangePassword(IKofaObject):
+    """Interface needed for change pasword page.
+
+    """
+    identifier = schema.TextLine(
+        title = _(u'Unique Identifier'),
+        description = _(u'User Name, Student or Applicant Id, Matriculation or Registration Number'),
+        required = True,
+        readonly = False,
+        )
+
+    email = schema.ASCIILine(
+        title = _(u'Email Address'),
+        required = True,
+        constraint=validate_email,
+        )
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 8345)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py	(revision 8346)
@@ -37,5 +37,4 @@
     KofaPage, KofaEditFormPage, KofaAddFormPage, KofaDisplayFormPage,
     ContactAdminForm, KofaForm, NullValidator)
-from waeup.kofa.browser.interfaces import ICaptchaManager
 from waeup.kofa.browser.breadcrumbs import Breadcrumb
 from waeup.kofa.browser.resources import datepicker, datatable, tabs, warning
@@ -55,5 +54,5 @@
     IStudentAccommodation, IStudentStudyLevel,
     ICourseTicket, ICourseTicketAdd, IStudentPaymentsContainer,
-    IStudentOnlinePayment, IBedTicket, IStudentsUtils, IStudentChangePassword
+    IStudentOnlinePayment, IBedTicket, IStudentsUtils
     )
 from waeup.kofa.students.catalog import search
@@ -1907,62 +1906,4 @@
         return
 
-class ChangePasswordRequestPage(KofaForm):
-    """Captcha'd page for students to request a password change.
-    """
-    grok.context(IUniversity)
-    grok.name('sendpw')
-    grok.require('waeup.Anonymous')
-    grok.template('sendpassword')
-    label = _('Send me a new password')
-    form_fields = grok.AutoFields(IStudentChangePassword)
-
-    def update(self):
-        # Handle captcha
-        self.captcha = getUtility(ICaptchaManager).getCaptcha()
-        self.captcha_result = self.captcha.verify(self.request)
-        self.captcha_code = self.captcha.display(self.captcha_result.error_code)
-        return
-
-    @action(_('Get new login credentials'), style='primary')
-    def request(self, **data):
-        if not self.captcha_result.is_valid:
-            # Captcha will display error messages automatically.
-            # No need to flash something.
-            return
-        # Search student or applicant
-        reg_number = data['reg_number']
-        email = data['email']
-        cat = queryUtility(ICatalog, name='students_catalog')
-        results = cat.searchResults(
-            reg_number=(reg_number, reg_number),
-            email=(email,email))
-        if len(results) == 0:
-            # Try also the applicants_catalog if no student record was found.
-            cat = queryUtility(ICatalog, name='applicants_catalog')
-            if cat is None:
-                self.flash(_('Application package not installed.'))
-                return
-            results = cat.searchResults(
-                reg_number=(reg_number, reg_number),
-                email=(email,email))
-        if len(results) == 0:
-            self.flash(_('No record found.'))
-            return
-        student = list(results)[0]
-        # Change password
-        kofa_utils = getUtility(IKofaUtils)
-        pwd = kofa_utils.genPassword()
-        IUserAccount(student).setPassword(pwd)
-        # Send email with new redentials
-        msg = _('You have successfully changed your password for the')
-        login_url = self.url(grok.getSite(), 'login')
-        success = kofa_utils.sendCredentials(
-            IUserAccount(student),pwd,login_url,msg)
-        if success:
-            self.flash(_('An email with your user name and password ' +
-                'has been sent to ${a}.', mapping = {'a':email}))
-        else:
-            self.flash(_('An smtp server error occurred.'))
-        return
 
 class SetPasswordPage(KofaPage):
Index: in/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/sendpassword.pt
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/sendpassword.pt	(revision 8345)
+++ 	(revision )
@@ -1,33 +1,0 @@
-<form action="." tal:attributes="action request/URL" method="post"
-      i18n:domain="waeup.kofa" enctype="multipart/form-data">
-
-  <table class="form-table">
-    <tbody>
-      <tal:widgets content="structure provider:widgets" />
-      <tr tal:condition="view/captcha_code">
-        <td i18n:translate="solve_captcha">
-          Please solve the captcha<br />to prevent misuse of this service:
-        </td>
-        <td>
-          <div tal:content="structure view/captcha_code"></div>
-        </td>
-      </tr>
-
-    </tbody>
-  </table>
-
-  <p i18n:translate="email_address_problem">
-    Enter the email address stored on Kofa.
-    You can't change your email address here.
-    If you've forgotten your email address or the email
-    address stored in Kofa is wrong or no longer valid,
-    use the enquiries form to request a change
-    of address.
-  </p>
-  <br />
-  <div tal:condition="view/availableActions">
-    <input tal:repeat="action view/actions"
-           tal:replace="structure action/render"
-           />
-  </div>
-</form>
Index: /main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py
===================================================================
--- /main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py	(revision 8345)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/interfaces.py	(revision 8346)
@@ -510,19 +510,2 @@
 IStudentOnlinePayment['p_level'].order = IStudentOnlinePayment[
     'p_session'].order
-
-
-class IStudentChangePassword(IKofaObject):
-    """Interface needed for change pasword page.
-
-    """
-    reg_number = schema.TextLine(
-        title = _(u'Registration Number'),
-        required = True,
-        readonly = False,
-        )
-
-    email = schema.ASCIILine(
-        title = _(u'Email Address'),
-        required = True,
-        constraint=validate_email,
-        )
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 8345)
+++ /main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py	(revision 8346)
@@ -1695,7 +1695,7 @@
     def test_change_password_request(self):
         self.browser.open('http://localhost/app/sendpw')
-        self.browser.getControl(name="form.reg_number").value = '123'
+        self.browser.getControl(name="form.identifier").value = '123'
         self.browser.getControl(name="form.email").value = 'aa@aa.ng'
-        self.browser.getControl("Get new login credentials").click()
+        self.browser.getControl("Get login credentials").click()
         self.assertTrue('An email with' in self.browser.contents)
 
