Index: WAeUP_SRP/trunk/WAeUPTables.py
===================================================================
--- WAeUP_SRP/trunk/WAeUPTables.py	(revision 989)
+++ WAeUP_SRP/trunk/WAeUPTables.py	(revision 990)
@@ -141,4 +141,5 @@
         #records = self.searchResults(uid=uid)
         records = self.searchResults(student = student_id)
+        #import pdb;pdb.set_trace()
         if len(records) > 0:
             for r in records:
@@ -160,5 +161,5 @@
             self.catalog_object(dict2ob(record_data), uid)
             return 1
-        if record.student != student_id:
+        if record.student.upper() != student_id.upper():
             return 0
         if record.student == student_id:
Index: WAeUP_SRP/trunk/Widgets.py
===================================================================
--- WAeUP_SRP/trunk/Widgets.py	(revision 989)
+++ WAeUP_SRP/trunk/Widgets.py	(revision 990)
@@ -1,4 +1,4 @@
 #-*- mode: python; mode: fold -*-
-
+# $Id$
 from cgi import escape
 from types import *
@@ -401,4 +401,10 @@
     """the ScratchCardPin"""
     def __init__(self,prefix,batch_no,number):
+        if not batch_no and not number:
+            s = prefix
+            if len(s) > 5:
+                prefix,batch_no,number = s[:3],s[3:-10],s[-10:]
+            else:
+                prefix,batch_no,number = '','',s
         self.p = prefix
         self.b = batch_no
@@ -428,6 +434,9 @@
         #import pdb;pdb.set_trace()
         if v and type(v) is StringType:
-            p,b,n = v.split('-')
-            v = ScratchCardPin(v,b,n)
+            try:
+                p,b,n = v.split('-')
+                v = ScratchCardPin(p,b,n)
+            except ValueError:
+                v = ScratchCardPin(v,'','')
         if v:
             p = '%s' % v.p
@@ -496,13 +505,21 @@
                 s_id = student.getId()
                 if ok == 2:
-                    err = "Please login with your Student Id %s and 10-digit PIN." % s_id
-                    s_logger.info("Student %s double used Pin %s" % (s_id,pin))
-                    break
-                if self.reference == "jamb_reg_no":
-                    res = self.students_catalog(jamb_reg_no = ref)
-                    if len(res) > 0:
+                    if self.reference == "jamb_reg_no":
+                        if hasattr(self.portal_directories.students,s_id):
+                            err = "Please login with your Student Id %s and 10-digit PIN." % s_id
+                            s_logger.info("Student %s double used Pin %s" % (s_id,pin))
+                            break
+                        else:
+                            s_logger.info("Student not Member %s double used Pin %s" % (s_id,pin))
+                    else:
                         err = "Please login with your Student Id %s and 10-digit PIN." % s_id
-                        s_logger.info("Student %s double checked Admission Pin %s" % (s_id,pin))
+                        s_logger.info("Student %s double used Pin %s" % (s_id,pin))
                         break
+##                if self.reference == "jamb_reg_no":
+##                    res = self.students_catalog(jamb_reg_no = ref)
+##                    if len(res) > 0:
+##                        err = "Please login with your Student Id %s and 10-digit PIN." % s_id
+##                        s_logger.info("Student %s double checked Admission Pin %s" % (s_id,pin))
+##                        break
                 try:
                     student.getContent().makeStudentMember(s_id,password=pin[4:])
@@ -539,6 +556,9 @@
         v = datamodel[self.fields[0]]
         if v and type(v) is StringType:
-            prefix,b,n = v.split('-')
-            v = ScratchCardPin(prefix,b,n)
+            try:
+                p,b,n = v.split('-')
+                v = ScratchCardPin(p,b,n)
+            except ValueError:
+                v = ScratchCardPin(v,'','')
         if v:
             prefix= '%s' % v.p
Index: WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py
===================================================================
--- WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 989)
+++ WAeUP_SRP/trunk/skins/waeup_custom/logged_in.py	(revision 990)
@@ -45,5 +45,5 @@
 member = mtool.getAuthenticatedMember()
 
-if not redirect_url or redirect_url.endswith('/logged_out'):
+if True or not redirect_url or redirect_url.endswith('/logged_out'):
     if not is_anon:
         if "Student" in member.getRoles():
@@ -60,4 +60,10 @@
                 da = {}
                 pin = request.get('pin')
+                if not pin:
+                    jamb_reg_no = info['app_doc'].jamb_reg_no
+                    res = context.portal_pins(student=jamb_reg_no)
+                    if len(res) == 1:
+                        p = res[0].pin
+                        pin = "%s-%s-%s" % (p[:3],p[3:4],p[4:]) 
 ##                email = request.get('email')
                 app_doc = info['app_doc']
