Author: channa
Date: Sat May  3 02:37:34 2008
New Revision: 16483

Log:

Changed self-reg form validations, formatting and error display, to 
complete OpenID implementation. MASHUP-689.


Modified:
   
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
   trunk/mashup/java/modules/www/register_self.jsp
   trunk/mashup/java/modules/www/registration_result.jsp

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
==============================================================================
--- 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
    (original)
+++ 
trunk/mashup/java/modules/core/src/org/wso2/mashup/webapp/identity/RegistrationBean.java
    Sat May  3 02:37:34 2008
@@ -52,6 +52,7 @@
     private String confirmedPassword;
     protected String emailId;
     private String captcha;
+    private String registrationError;
 
     private boolean adminCreation;
     protected Hashtable errors;
@@ -112,6 +113,10 @@
         this.adminCreation = adminCreation;
     }
 
+    public String getRegistrationError() {
+        return registrationError;
+    }
+
     /**
      * Initialize bean values.
      */
@@ -146,6 +151,7 @@
             success = true;
         } catch (UserStoreException e) {
             log.error("Error perrforming self registration", e);
+            registrationError = e.getMessage();
         }
 
         return success;

Modified: trunk/mashup/java/modules/www/register_self.jsp
==============================================================================
--- trunk/mashup/java/modules/www/register_self.jsp     (original)
+++ trunk/mashup/java/modules/www/register_self.jsp     Sat May  3 02:37:34 2008
@@ -53,7 +53,9 @@
                         "registration_result.jsp?success=true&bounceback=" + 
bounceback);
             } else {
                 response.sendRedirect(
-                        "registration_result.jsp?success=false&bounceback=" + 
bounceback);
+                        "registration_result.jsp?success=false&bounceback=" + 
bounceback
+                        + "&details=" + 
URLEncoder.encode(registrationHandler.getRegistrationError(),
+                                                          "UTF-8"));
             }
         }
     }
@@ -74,7 +76,7 @@
 
             for (var x = 0; x < inputs.length; x++) {
                 if (((inputs[x].type == "text") || (inputs[x].type == 
"password")) &&
-                    (inputs[x].value == "")) {
+                    (inputs[x].value == "") && inputs[x].name !="openIdUrl") {
 
                     switch (inputs[x].name) {
                         case "userName":
@@ -111,16 +113,21 @@
 <% String thisPage = "register_self.jsp"; %>
 <%@ include file="header.jsp" %>
 <div id="search"></div>
-<div id="content" style="height:400px; ">
+<div id="content" style="height:500px; ">
 <% if (RegistrationBean.isSelfRegistrationEnabled()) { %>
-<div class="mashup_title">Self Registration - will be verified via e-mail</div>
+<div class="mashup_title">Self Registration</div>
 <br/>
-<table>
+<table  width="875" border="0" cellpadding="1" cellspacing="0" class="box" 
align="center">
+<tr>
+    <th width="50%">Register Manually</th>
+    <th width="25%">Register Using InfoCard</th>
+    <th width="25%">Register Using OpenID</th>
+</tr>
 <tr>
     <td>
         <form name="formRegisterSelf" method='post' action="register_self.jsp" 
onsubmit="return validateInput();">
             <input type="hidden" name="bounceback" value="<%=bounceback%>"/>
-            <table width="100%" border="0" cellpadding="3" cellspacing="0">
+            <table width="100%" border="0" cellpadding="1" cellspacing="0">
                 <tr>
                     <td width="130"><label><strong>User Name:<font 
color="#FF0000">*</font></strong></label></td>
                     <td><input type="text" name="userName"
@@ -194,14 +201,8 @@
                     }
                 %>
                 <tr>
-                    <td>&nbsp;</td>
-                    <td><input type="submit" value="Register"/> <input 
type="button" value="Cancel"
-                                                                       
onclick="document.location = '<%= bounceback %>';">
-                    </td>
-                </tr>
-                <tr>
-                    <td>&nbsp;</td>
-                    <td align="center"></td>
+                    <td><input type="submit" value="Register"/> </td>
+                    <td><input type="button" value="Cancel" 
onclick="document.location = '<%= bounceback %>';"></td>
                 </tr>
             </table>
         </form>
@@ -210,25 +211,28 @@
         <a 
href="infocard.jsp?fromselfreg=true&bounceback=<%=URLEncoder.encode(bounceback,"UTF-8")%>"><img
                 src="images/infocard_92x64.png" border="0"></a>
         <br/>
-        Fill up your details using your personal or managed infocard.
+        Get details from my personal or managed infocard.
         <br/>
         <br/>
-        <a href="http://wso2.org/projects/solutions/identity";
-           target="_blank"><img src="images/powered_identity.gif"
-                                border="0"></a>
     </td>
     <td align="center" valign="top" height="175">
         <form name="openidsignin" id="openidsignin" method="post" 
action="openidsubmit.jsp">
             <img src="images/openid-logo.jpg" border="0"><br/>
-            Enter Your OpenID Url for self registration:<input type="text" 
name="openIdUrl"/>
+            Get details from my OpenID:<br/>
+            <input type="text" name="openIdUrl"/>
             <input type="hidden" name="calledfrom" value="registration"/>
             <input type="submit" name="submit" value="Register"/>
         </form>
     </td>
 </tr>
+<tr>
+    <td><strong><font color="#FF0000">*</font></strong> Required 
fields<br></td>
+    <td colspan="2">
+        <a href="http://wso2.org/projects/solutions/identity"; 
target="_blank"><img src="images/powered_identity.gif"
+                                border="0"></a>
+    </td>
+</tr>
 </table>
-<strong><font color="#FF0000">*</font></strong> Required fields
-<br>
 <% } else { %>
 <div class="mashup_title">Self Registration Disabled</div>
 <div>&nbsp; Self-registration disabled. Please contact administrator to 
register yourself.</div>

Modified: trunk/mashup/java/modules/www/registration_result.jsp
==============================================================================
--- trunk/mashup/java/modules/www/registration_result.jsp       (original)
+++ trunk/mashup/java/modules/www/registration_result.jsp       Sat May  3 
02:37:34 2008
@@ -23,7 +23,7 @@
 <%
     ResourceBundle bundle = ResourceBundle.getBundle("UI");
     UserRegistry userRegistry = RegistryUtils.getRegistry(request);
-    
+    String details = "";
     String bounceback = request.getParameter("bounceback");
     String success = request.getParameter("success");
     if (bounceback == null) {
@@ -31,6 +31,10 @@
     } else {
         bounceback = URLDecoder.decode(bounceback, "UTF-8");
     }
+
+    if (!"true".equals(success)) {
+        details = URLDecoder.decode(request.getParameter("details"), "UTF-8");
+    }
 %>
 <html>
 <head>
@@ -60,6 +64,8 @@
                         <strong>Please check the mail account you specified 
and click on the link sent to verify your registration.</strong></div>          
              
                     <% } else { %>
                     <div class="login-error"><img src="images/error.gif" 
align="absmiddle">&nbsp; Self-registration failed. Please try again.</div>
+                    <br/>
+                    <strong>Details:</strong>&nbsp;<%=details%>
                     <% } %>
                    
                 </td>

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

Reply via email to