Author: channa
Date: Wed Jan  9 00:45:34 2008
New Revision: 12017

Log:

Adding check for infocard data capture errors.

Modified:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
   trunk/mashup/java/modules/www/register_self_infocard.jsp

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
    (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/InfoCardRegistrationBean.java
    Wed Jan  9 00:45:34 2008
@@ -183,8 +183,10 @@
     /**
      * Retrieve the user's claims from the infocard, to be used in 
registration.
      * @param request Servlet request object.
+     * @return True if infocard information has been retrieved successfully.
      */
-    public void setInfoCardDetails(HttpServletRequest request) {
+    public boolean setInfoCardDetails(HttpServletRequest request) {
+        boolean infocardOk = false;
         HttpSession session = request.getSession();
 
         // If infocard has been successfully used, proceed.
@@ -200,6 +202,8 @@
             session.setAttribute(FULL_NAME, fullName);
             emailId = (String) 
request.getAttribute(IdentityConstants.CLAIM_EMAIL_ADDRESS);
             session.setAttribute(EMAIL_ID, emailId);
+            infocardOk = true;
         }
+        return infocardOk;
     }
 }

Modified: trunk/mashup/java/modules/www/register_self_infocard.jsp
==============================================================================
--- trunk/mashup/java/modules/www/register_self_infocard.jsp    (original)
+++ trunk/mashup/java/modules/www/register_self_infocard.jsp    Wed Jan  9 
00:45:34 2008
@@ -66,8 +66,9 @@
     <jsp:setProperty name="infoCardRegHandler" property="*"/>
 </jsp:useBean>
 <%
+        boolean infocardOk = false;
         if ("Log in".equals(infoCardPresented)) {
-            infoCardRegHandler.setInfoCardDetails(request);
+            infocardOk = infoCardRegHandler.setInfoCardDetails(request);
         } else {
         if (infoCardRegHandler.isInputValid(request)) {
             if (infoCardRegHandler.register()) {
@@ -96,7 +97,13 @@
     <%@ include file="header.jsp" %>
        <div id="search"></div>
     <div id="content" style="height:400px; ">
-        <% if (RegistrationBean.isSelfRegistrationEnabled()) { %>
+        <% if (RegistrationBean.isSelfRegistrationEnabled()) {
+            if ("Log in".equals(infoCardPresented) && !infocardOk) { %>
+        <div class="mashup_title">Infocard Error</div>
+        <div>&nbsp; Infocard submission failed. Please register using another 
card or by entering
+            data manually <a 
href="signin.jsp?bounceback=<%=URLEncoder.encode(thisPage,"UTF-8")%>">here</a>.
+        </div>
+        <% } else { %>
     <div class="mashup_title">Your infocard details have been added and will 
be verified via e-mail</div>
       <br />
                     <form name="formRegisterSelf" method='post' 
action="register_self_infocard.jsp">
@@ -144,7 +151,8 @@
                         </table>
                      </form>
         <br>
-        <% } else { %>
+        <% }
+        } else { %>
             <div class="mashup_title">Self Registration Disabled</div>
             <div>&nbsp; Self-registration disabled. Please contact 
administrator to register yourself.</div>
         <% } %>

_______________________________________________
Mashup-dev mailing list
[email protected]
http://www.wso2.org/cgi-bin/mailman/listinfo/mashup-dev

Reply via email to