Author: tyrell
Date: Mon Jan 21 05:59:05 2008
New Revision: 12640

Log:

Minor performance enhancement.

Modified:
   trunk/mashup/java/modules/www/validate_login.jsp

Modified: trunk/mashup/java/modules/www/validate_login.jsp
==============================================================================
--- trunk/mashup/java/modules/www/validate_login.jsp    (original)
+++ trunk/mashup/java/modules/www/validate_login.jsp    Mon Jan 21 05:59:05 2008
@@ -43,30 +43,34 @@
     ResourceBundle bundle = ResourceBundle.getBundle("UI");
     Registry registry = RegistryUtils.getRegistry(request);
 
-    //Check whether the remember me option is set
-    Cookie[] cookies = request.getCookies();
+    //Checking whether the user is logged in
+    if (!RegistryUtils.isLoggedIn(registry)) {
 
-    if (cookies != null) {
-        boolean rememberMe = false;
-        String userNameStored = null;
-        String passwordStored = null;
-
-        Cookie curCookie = null;
-        for (int x = 0; x < cookies.length; x++) {
-            curCookie = cookies[x];
-            if (curCookie.getName().equalsIgnoreCase("rememberMe")) {
-                rememberMe = true;
-            } else if (curCookie.getName().equalsIgnoreCase("username")) {
-                userNameStored = curCookie.getValue();
-            } else if (curCookie.getName().equalsIgnoreCase("password")) {
-                passwordStored =
-                        new String(new 
sun.misc.BASE64Decoder().decodeBuffer(curCookie.getValue()),
-                                   "UTF-8");
+        //Check whether the remember me option is set
+        Cookie[] cookies = request.getCookies();
+
+        if (cookies != null) {
+            boolean rememberMe = false;
+            String userNameStored = null;
+            String passwordStored = null;
+
+            Cookie curCookie = null;
+            for (int x = 0; x < cookies.length; x++) {
+                curCookie = cookies[x];
+                if (curCookie.getName().equalsIgnoreCase("rememberMe")) {
+                    rememberMe = true;
+                } else if (curCookie.getName().equalsIgnoreCase("username")) {
+                    userNameStored = curCookie.getValue();
+                } else if (curCookie.getName().equalsIgnoreCase("password")) {
+                    passwordStored =
+                            new String(
+                                    new 
sun.misc.BASE64Decoder().decodeBuffer(curCookie.getValue()),
+                                    "UTF-8");
+                }
             }
-        }
 
-        if (rememberMe && (userNameStored != null) && (passwordStored != 
null)) {
-            if (!RegistryUtils.isLoggedIn(registry)) {
+            if (rememberMe && (userNameStored != null) && (passwordStored != 
null)) {
+
                 ServletContext context = 
request.getSession().getServletContext();
 
                 JDBCRegistry jdbcRegistry = (JDBCRegistry) 
context.getAttribute(
@@ -82,6 +86,7 @@
                 
request.getSession().setAttribute(MashupConstants.USER_REGISTRY, 
secureRegistry);
 
                 registry = secureRegistry;
+
             }
         }
     }

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

Reply via email to