Index: main/waeup.sirp/trunk/src/waeup/sirp/applicants/authentication.py
===================================================================
--- main/waeup.sirp/trunk/src/waeup/sirp/applicants/authentication.py	(revision 5817)
+++ main/waeup.sirp/trunk/src/waeup/sirp/applicants/authentication.py	(revision 5818)
@@ -28,5 +28,5 @@
 from zope.pluggableauth.factories import Principal
 from zope.pluggableauth.interfaces import (
-    ICredentialsPlugin, IAuthenticatorPlugin, IPrincipalInfo,
+    ICredentialsPlugin, IAuthenticatorPlugin,
     IAuthenticatedPrincipalFactory, AuthenticatedPrincipalCreated)
 from zope.pluggableauth.plugins.session import SessionCredentialsPlugin
@@ -34,12 +34,10 @@
 from zope.publisher.interfaces.http import IHTTPRequest
 from zope.session.interfaces import ISession
-from waeup.sirp.authentication import Account, PrincipalInfo
+from waeup.sirp.accesscodes import get_access_code
 from waeup.sirp.applicants.interfaces import (
     IApplicantPrincipalInfo, IApplicantPrincipal, IApplicantSessionCredentials,
     IJAMBApplicantSessionCredentials)
-from waeup.sirp.applicants import (
-    get_applicant_data, application_exists,
-    )
-from waeup.sirp.accesscodes import get_access_code
+from waeup.sirp.applicants import get_applicant_data
+
 
 class PortalUser(grok.Role):
@@ -54,11 +52,10 @@
     grok.implements(IApplicantPrincipalInfo)
 
-    def __init__(self, access_code, jamb_reg_no=None):
-        self.id = principal_id(access_code, jamb_reg_no)
+    def __init__(self, access_code):
+        self.id = principal_id(access_code)
         self.title = u'Applicant'
         self.description = u'An Applicant'
         self.credentialsPlugin = None
         self.authenticatorPlugin = None
-        self.reg_no = jamb_reg_no
         self.access_code = access_code
 
@@ -72,6 +69,6 @@
     grok.implements(IApplicantPrincipal)
 
-    def __init__(self, access_code, reg_no, prefix=None):
-        self.id = principal_id(access_code, reg_no)
+    def __init__(self, access_code, prefix=None):
+        self.id = principal_id(access_code)
         if prefix is not None:
             self.id = '%s.%s' % (prefix, self.id)
@@ -79,5 +76,4 @@
         self.description = u'An applicant'
         self.groups = []
-        self.reg_no = reg_no
         self.access_code = access_code
 
@@ -103,5 +99,4 @@
         principal = ApplicantPrincipal(
             self.info.access_code,
-            self.info.reg_no,
             authentication.prefix,
             )
@@ -144,12 +139,6 @@
     grok.implements(IJAMBApplicantSessionCredentials)
 
-    def __init__(self, access_code, jamb_reg_no):
-        self.access_code = access_code
-        self.jamb_reg_no = jamb_reg_no
-
-    def getJAMBRegNo(self):
-        """Get the JAMB registration no.
-        """
-        return self.jamb_reg_no
+    def __init__(self, access_code):
+        self.access_code = access_code
 
 class WAeUPApplicantCredentialsPlugin(grok.GlobalUtility,
@@ -164,5 +153,4 @@
     accesscode_series_field = 'form.ac_series'
     accesscode_number_field = 'form.ac_number'
-    jamb_reg_no_field = 'form.jamb_reg_no'
 
     def extractCredentials(self, request):
@@ -177,5 +165,4 @@
         access_code_series = request.get(self.accesscode_series_field, None)
         access_code_no = request.get(self.accesscode_number_field, None)
-        jamb_reg_no = request.get(self.jamb_reg_no_field, None)
         access_code = '%s-%s-%s' % (
             access_code_prefix, access_code_series, access_code_no)
@@ -184,8 +171,5 @@
         credentials = None
 
-        if access_code and jamb_reg_no:
-            credentials = JAMBApplicantCredentials(
-                access_code, jamb_reg_no)
-        elif access_code:
+        if access_code:
             credentials = ApplicantCredentials(access_code)
         elif not sessionData:
@@ -204,10 +188,8 @@
             # its structure.
             return None
-        if not IJAMBApplicantSessionCredentials.providedBy(credentials):
-            # Entered credentials are ordinary applicant credentials,
-            # not JAMB-screened applicant credentials
-            return {'accesscode': credentials.getAccessCode()}
-        return {'accesscode': credentials.getAccessCode(),
-                'jambregno': credentials.getJAMBRegNo()}
+
+        # Entered credentials are ordinary applicant credentials,
+        # not JAMB-screened applicant credentials
+        return {'accesscode': credentials.getAccessCode()}
 
 
@@ -226,19 +208,16 @@
             return None
         accesscode = credentials.get('accesscode', None)
-        jambregno = credentials.get('jambregno', None)
         if accesscode is None:
             return None
-        applicant_data, ac = get_applicant_data(jambregno, accesscode)
+        applicant_data = get_applicant_data(accesscode)
+        ac = get_access_code(accesscode) # Get the real access code object
         appl_ac = getattr(applicant_data, 'access_code', None)
-        #print "AUTH", accesscode, jambregno
         if ac is None:
             return None
-        if jambregno is not None and applicant_data is None:
-            return None
         if ac.invalidation_date is not None and appl_ac != ac.representation:
             return None
         if appl_ac is not None and appl_ac != ac.representation:
             return None
-        return ApplicantPrincipalInfo(accesscode, jambregno)
+        return ApplicantPrincipalInfo(accesscode)
 
     def principalInfo(self, id):
@@ -254,5 +233,5 @@
         return None
 
-def principal_id(access_code, jamb_reg_no=None):
+def principal_id(access_code):
     """Get a principal ID for applicants.
 
