Author: tyrell
Date: Wed Jan 16 08:30:09 2008
New Revision: 12356

Log:

Changing the 'Remember Me' implementation to a purely cookie based one. The 
previous one depending on the session time out will not scale.

Modified:
   trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
   trunk/mashup/java/modules/www/index.jsp
   trunk/mashup/java/modules/www/signin.jsp
   trunk/mashup/java/modules/www/signout.jsp

Modified: 
trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java
==============================================================================
--- trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java     
(original)
+++ trunk/mashup/java/modules/core/src/org/wso2/mashup/MashupConstants.java     
Wed Jan 16 08:30:09 2008
@@ -37,11 +37,10 @@
     public static String ICQ = IM_CONFIG + "." + "ICQ";
     public static String JABBER = IM_CONFIG + "." + "Jabber";
     public static String YAHOO = IM_CONFIG + "." + "Yahoo";
+
     public static String SESSION_MANAGEMENT = "SessionManagement";
     public static String REMEMBER_ME_PERIOD = "RememberMePeriod";
-    public static String ORIGINAL_INACTIVE_INTERVAL = 
"OriginalInactiveInterval";
-
-
+    
     public static String QUARTZ_FUNCTION_SCHEDULER = "FunctionScheduler";
 
     public static final String EMAIL_RELAY_HOST = "email_relay_host";

Modified: trunk/mashup/java/modules/www/index.jsp
==============================================================================
--- trunk/mashup/java/modules/www/index.jsp     (original)
+++ trunk/mashup/java/modules/www/index.jsp     Wed Jan 16 08:30:09 2008
@@ -23,6 +23,7 @@
 <%@ page import="com.sun.syndication.io.SyndFeedOutput" %>
 <%@ page import="org.apache.axis2.context.ConfigurationContext" %>
 <%@ page import="org.wso2.mashup.MashupConstants" %>
+<%@ page import="org.wso2.mashup.MashupFault" %>
 <%@ page import="org.wso2.mashup.utils.MashupUtils" %>
 <%@ page import="org.wso2.mashup.utils.QueryResult" %>
 <%@ page import="org.wso2.mashup.utils.QueryResults" %>
@@ -52,6 +53,7 @@
 <%@ page import="java.net.URLDecoder" %>
 <%@ page import="java.util.ArrayList" %>
 <%@ page import="java.util.Date" %>
+<%@ page import="java.util.HashMap" %>
 <%@ page import="java.util.Iterator" %>
 <%@ page import="java.util.List" %>
 <%@ page import="java.util.Map" %>
@@ -59,12 +61,55 @@
     if (!MashupUtils.isInitialSetupComplete() && 
MashupConstants.LOCALHOST.equalsIgnoreCase(
             request.getLocalName())) {
         response.sendRedirect("register_admin.jsp?firstcall=true");
-    }    
+    }
 
     Registry registry = RegistryUtils.getRegistry(request);
-    User userProfile = 
RegistryUtils.getUserProfile(RegistryUtils.getCurrentUser(registry), registry);
+    User userProfile =
+            
RegistryUtils.getUserProfile(RegistryUtils.getCurrentUser(registry), registry);
 
-    String thisPage = "index.jsp";   
+    //Check whether the remember me option is set
+    Cookie cookies[] = request.getCookies();
+
+    boolean rememberMe = false;
+    String userName = null;
+    String password = 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")) {
+            userName = curCookie.getValue();
+        } else if (curCookie.getName().equalsIgnoreCase("password")) {
+            password = new String(new 
sun.misc.BASE64Decoder().decodeBuffer(curCookie.getValue()),
+                                  "UTF-8");
+        }
+    }
+
+    if (rememberMe && (userName != null) && (password != null)) {
+        if (!RegistryUtils.isLoggedIn(registry)) {
+            ServletContext context = request.getSession().getServletContext();
+
+            JDBCRegistry jdbcRegistry = (JDBCRegistry) context.getAttribute(
+                    RegistryConstants.REGISTRY);
+
+            Realm realm = (Realm) 
context.getAttribute(RegistryConstants.REGISTRY_REALM);
+
+            MashupUtils.login(userName, password);
+
+            SecureRegistry secureRegistry =
+                    new SecureRegistry(userName, jdbcRegistry, realm);
+
+            request.getSession().setAttribute(MashupConstants.USER_REGISTRY, 
secureRegistry);
+
+            registry = RegistryUtils.getRegistry(request);
+            userProfile =
+                    
RegistryUtils.getUserProfile(RegistryUtils.getCurrentUser(registry), registry);
+        }
+    }
+
+    String thisPage = "index.jsp";
 
 %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>
 <html>
@@ -139,14 +184,14 @@
                     newFirstDiv.insert({ after: newSecondDiv });
                     
                     // Clean up the controls of the first div
-                    $(newFirstDiv.id + "down").style.visibility="visible";
+                    $(newFirstDiv.id + "down").style.visibility = "visible";
                     if (!newFirstDiv.previous())
-                        $(newFirstDiv.id + "up").style.visibility="hidden";
+                        $(newFirstDiv.id + "up").style.visibility = "hidden";
 
                     // Clean up the controls of the second div
-                    $(newSecondDiv.id + "up").style.visibility="visible";
+                    $(newSecondDiv.id + "up").style.visibility = "visible";
                     if (!newSecondDiv.next())
-                        $(newSecondDiv.id + "down").style.visibility="hidden";
+                        $(newSecondDiv.id + "down").style.visibility = 
"hidden";
                 }
             });
         }
@@ -180,149 +225,164 @@
         String[] params = queries[i].getQueryParameters();
         String title = queries[i].getTitle();
 
-            results = RegistryUtils.doQuery(registry, title, queryPath, 
params, MashupConstants.SHOW_RESULTS_COUNT);
-    %>
-    
-    <div id="query<%=nextId%>" class="querypane">
-        <div class="heading"><%= title%>
+        results = RegistryUtils
+                .doQuery(registry, title, queryPath, params, 
MashupConstants.SHOW_RESULTS_COUNT);
+%>
+
+<div id="query<%=nextId%>" class="querypane">
+<div class="heading"><%= title%>
             <span class="edit-link"><a
-                    
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>&format=rss" target="_blank"><img  title="RSS feed" 
src="images/rss.png"/></a></span>
+                    
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>&format=rss"
+                    target="_blank"><img title="RSS feed" 
src="images/rss.png"/></a></span>
             <span class="edit-link"><a
-                    
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>&format=atom" target="_blank"><img title="Atom feed" 
src="images/atom.png"/></a></span>
+                    
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>&format=atom"
+                    target="_blank"><img title="Atom feed" 
src="images/atom.png"/></a></span>
+</div>
+<table width="95%" border="0" cellpadding="3" cellspacing="0" class="data">
+<tbody>
+<tr>
+    <% if (results.getResultsType().equals("activity")) { %>
+    <td class="headers" width="12%" colspan="2">When</td>
+    <td class="headers" colspan="2">Activity</td>
+    <% } else if (results.getResultsType().equals("comment")) { %>
+    <td width="12%" class="headers">Date</td>
+    <td width="12%" class="headers">By</td>
+    <td width="12%" class="headers">On</td>
+    <td class="headers" colspan="2">Comment</td>
+    <% } else { %>
+    <td width="12%" class="headers">Name</td>
+    <td width="12%" class="headers" colspan="2">Author</td>
+    <td class="headers">Description</td>
+    <% } %>
+
+    <td width="86" class="headers">
+        <div class="query-controls">
+            <% if (RegistryUtils.isLoggedIn(registry)) { %>
+            <img src="images/arrowUp.gif" id="query<%=nextId%>up" 
class="edit-link" title="move up"
+                 <% if (i == 0) { %>style="visibility:hidden"<% } %>
+                 onclick="moveQuery('query<%=nextId%>', 
'<%=queryPath%>','<%=QueryParamUtils.paramsToString(params)%>', 'up')"/>
+            <img src="images/arrowDown.gif" id="query<%=nextId%>down" 
class="edit-link"
+                 title="move down"
+                 <% if (i == queries.length - 1) { 
%>style="visibility:hidden"<% } %>
+                 onclick="moveQuery('query<%=nextId%>', 
'<%=queryPath%>','<%=QueryParamUtils.paramsToString(params)%>', 'down')"/>
+            <img src="images/remove.gif" class="edit-link" title="remove from 
home page"
+                 onclick="deleteQuery('query<%=nextId%>', 
'<%=queryPath%>','<%=QueryParamUtils.paramsToString(params)%>')"/>
+            <% } %>
         </div>
-        <table width="95%" border="0" cellpadding="3" cellspacing="0" 
class="data">
-            <tbody>
-                <tr>
-<% if (results.getResultsType().equals("activity")) { %>
-                    <td class="headers" width="12%" colspan="2">When</td>
-                    <td class="headers" colspan="2">Activity</td>
-<% } else if (results.getResultsType().equals("comment")) { %>
-                    <td width="12%" class="headers">Date</td>
-                    <td width="12%" class="headers">By</td>
-                    <td width="12%" class="headers">On</td>
-                    <td class="headers" colspan="2">Comment</td>
-<% } else { %>
-                    <td width="12%" class="headers">Name</td>
-                    <td width="12%" class="headers" colspan="2">Author</td>
-                    <td class="headers">Description</td>
-<% } %>
-
-                    <td width="86" class="headers">
-                        <div class="query-controls">
-                            <% if (RegistryUtils.isLoggedIn(registry)) { %>
-                            <img src="images/arrowUp.gif" 
id="query<%=nextId%>up" class="edit-link" title="move up"
-                                  <% if (i == 0) { 
%>style="visibility:hidden"<% } %>
-                                  onclick="moveQuery('query<%=nextId%>', 
'<%=queryPath%>','<%=QueryParamUtils.paramsToString(params)%>', 'up')" />
-                            <img src="images/arrowDown.gif" 
id="query<%=nextId%>down" class="edit-link" title="move down"
-                                  <% if (i == queries.length - 1) { 
%>style="visibility:hidden"<% } %>
-                                  onclick="moveQuery('query<%=nextId%>', 
'<%=queryPath%>','<%=QueryParamUtils.paramsToString(params)%>', 'down')" />
-                            <img src="images/remove.gif" class="edit-link" 
title="remove from home page"
-                                 onclick="deleteQuery('query<%=nextId%>', 
'<%=queryPath%>','<%=QueryParamUtils.paramsToString(params)%>')" />
-                            <% } %>
-                        </div>
-                    </td>
-                </tr>
+    </td>
+</tr>
 
 <%
 
-        Iterator iter = results.getResults().iterator();
-        if (!iter.hasNext()) { %>
-    <tr class="noresults">
-        <td valign="top" colspan="4">
-            No results found.
-        </td>
-        <td><a href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>">refine&nbsp;query...</a></td>
-    </tr>
-<%      }
-
-        while (iter.hasNext()) {
-            QueryResult result = (QueryResult) iter.next();
-            String id = "id" + nextId;
-            String path = result.getPath();
+    Iterator iter = results.getResults().iterator();
+    if (!iter.hasNext()) { %>
+<tr class="noresults">
+    <td valign="top" colspan="4">
+        No results found.
+    </td>
+    <td><a href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>">refine&nbsp;query...</a>
+    </td>
+</tr>
+<% }
+
+    while (iter.hasNext()) {
+        QueryResult result = (QueryResult) iter.next();
+        String id = "id" + nextId;
+        String path = result.getPath();
 
-            if (results.getResultsType().equals("activity")) {
-                String action = result.getAction();
+        if (results.getResultsType().equals("activity")) {
+            String action = result.getAction();
 
 %>
 
-    <tr class="results">
-        <td width="12%" valign="top">
-            <nobr><%=QueryParamUtils.friendlyDate(result.getDate())%></nobr>
-        </td>
-        <td width="1" valign="top"><img src="images/ra.gif"/></td>
-        <td valign="top" colspan="3">
-            <% if 
(result.getAuthor().equals(RegistryUtils.getCurrentUser(registry))) { %>
-                <a href="user.jsp?name=<%=result.getAuthor()%>">You</a>
-            <% } else { %>
-                <a 
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
 result.getAuthor())%></a> (<%=result.getAuthor()%>)
-            <% } %>
-            <%= action %>
-            <% if (action.equals("commented")) { %>on<% } %>
-            <a href="mashup.jsp?path=<%=path%>"><%=result.getName()%></a>
-            <% if (action.equals("rated")) { %>
-                <%=result.getContentString() %> stars
-            <% } else if (action.equals("commented")) { %>
-                <span class="inline-comment">"<%=result.getContentString() 
%>"</span>
-            <% } %>
-        </td>
-    </tr>
+<tr class="results">
+    <td width="12%" valign="top">
+        <nobr><%=QueryParamUtils.friendlyDate(result.getDate())%>
+        </nobr>
+    </td>
+    <td width="1" valign="top"><img src="images/ra.gif"/></td>
+    <td valign="top" colspan="3">
+        <% if 
(result.getAuthor().equals(RegistryUtils.getCurrentUser(registry))) { %>
+        <a href="user.jsp?name=<%=result.getAuthor()%>">You</a>
+        <% } else { %>
+        <a href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils
+                .getFullName(request, result.getAuthor())%>
+        </a> (<%=result.getAuthor()%>)
+        <% } %>
+        <%= action %>
+        <% if (action.equals("commented")) { %>on<% } %>
+        <a href="mashup.jsp?path=<%=path%>"><%=result.getName()%>
+        </a>
+        <% if (action.equals("rated")) { %>
+        <%=result.getContentString() %> stars
+        <% } else if (action.equals("commented")) { %>
+        <span class="inline-comment">"<%=result.getContentString() %>"</span>
+        <% } %>
+    </td>
+</tr>
 
 <%
-            } else if (results.getResultsType().equals("comment")) {
+} else if (results.getResultsType().equals("comment")) {
 %>
 
-    <tr class="results">
-        <td width="12%" valign="top">
-            <nobr><%=QueryParamUtils.friendlyDate(result.getDate())%></nobr>
-        </td>
-        <td nowrap>
-             <a class="updatableName"
-                
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
-                     result.getAuthor())%></a> (<%=result.getAuthor()%>)
-        </td>
-        <td nowrap>
-            <a 
href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%></a>
-        </td>
-        <td class="desc" colspan="2">
-             <%=result.getContentString() %>
-         </td>
-     </tr>
+<tr class="results">
+    <td width="12%" valign="top">
+        <nobr><%=QueryParamUtils.friendlyDate(result.getDate())%>
+        </nobr>
+    </td>
+    <td nowrap>
+        <a class="updatableName"
+           
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
+                                                                               
      result.getAuthor())%>
+        </a> (<%=result.getAuthor()%>)
+    </td>
+    <td nowrap>
+        <a href="mashup.jsp?path=<%=result.getPath()%>"><%=result.getName()%>
+        </a>
+    </td>
+    <td class="desc" colspan="2">
+        <%=result.getContentString() %>
+    </td>
+</tr>
 
 <%
-            } else {
+} else {
 %>
-    <tr class="results">
-        <td width="1" nowrap>
-            <a href="mashup.jsp?path=<%=path%>"><%=result.getName()%>
-            </a>
-        </td>
-        <td nowrap>
-            <a 
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
-                         result.getAuthor())%></a> (<%=result.getAuthor()%>)
-        </td>
-        <td colspan="2">
-            <%=result.getDescription() %>
-        </td>
-        <td nowrap>
-            <%@ include file="rating.jsp" %>
-        </td>
-    </tr>
-    <%
+<tr class="results">
+    <td width="1" nowrap>
+        <a href="mashup.jsp?path=<%=path%>"><%=result.getName()%>
+        </a>
+    </td>
+    <td nowrap>
+        <a 
href="user.jsp?name=<%=result.getAuthor()%>"><%=RegistryUtils.getFullName(request,
+                                                                               
      result.getAuthor())%>
+        </a> (<%=result.getAuthor()%>)
+    </td>
+    <td colspan="2">
+        <%=result.getDescription() %>
+    </td>
+    <td nowrap>
+        <%@ include file="rating.jsp" %>
+    </td>
+</tr>
+<%
 
-            }
-            nextId++;
         }
-        if (results.getResultCount() > MashupConstants.SHOW_RESULTS_COUNT) { %>
-                <tr>
-                    <td colspan="5">
-                        <div class="more"><a 
href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>&controls=false">more results...</a></div>
-                    </td>
-                </tr>
-<%      } %>
-            </tbody>
-        </table>
-        <br/>
-    </div>
+        nextId++;
+    }
+    if (results.getResultCount() > MashupConstants.SHOW_RESULTS_COUNT) { %>
+<tr>
+    <td colspan="5">
+        <div class="more"><a
+                href="search.jsp?<%=QueryParamUtils.paramsFromQuery(queryPath, 
params)%>&controls=false">more
+            results...</a></div>
+    </td>
+</tr>
+<% } %>
+</tbody>
+</table>
+<br/>
+</div>
 
 <% } %>
 </div>

Modified: trunk/mashup/java/modules/www/signin.jsp
==============================================================================
--- trunk/mashup/java/modules/www/signin.jsp    (original)
+++ trunk/mashup/java/modules/www/signin.jsp    Wed Jan 16 08:30:09 2008
@@ -14,8 +14,13 @@
  * limitations under the License.
 --%>
 <%@ page errorPage="error.jsp" %>
-<%@ page import="com.sun.syndication.feed.synd.*"
+<%@ page import="com.sun.syndication.feed.synd.SyndContent"
         %>
+<%@ page import="com.sun.syndication.feed.synd.SyndContentImpl" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndEntry" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndEntryImpl" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndFeed" %>
+<%@ page import="com.sun.syndication.feed.synd.SyndFeedImpl" %>
 <%@ page import="com.sun.syndication.io.SyndFeedOutput" %>
 <%@ page import="org.apache.axis2.context.ConfigurationContext" %>
 <%@ page import="org.wso2.mashup.MashupConstants" %>
@@ -30,20 +35,32 @@
 <%@ page import="org.wso2.mashup.webapp.userprofile.UserQuery" %>
 <%@ page import="org.wso2.mashup.webapp.utils.QueryParamUtils" %>
 <%@ page import="org.wso2.mashup.webapp.utils.RegistryUtils" %>
-<%@ page import="org.wso2.registry.*" %>
+<%@ page import="org.wso2.registry.Comment" %>
+<%@ page import="org.wso2.registry.Registry" %>
+<%@ page import="org.wso2.registry.RegistryConstants" %>
+<%@ page import="org.wso2.registry.RegistryException" %>
+<%@ page import="org.wso2.registry.Resource" %>
+<%@ page import="org.wso2.registry.Tag" %>
 <%@ page import="org.wso2.registry.jdbc.JDBCRegistry" %>
 <%@ page import="org.wso2.registry.secure.SecureRegistry" %>
 <%@ page import="org.wso2.usermanager.Realm" %>
 <%@ page import="org.wso2.usermanager.UserManagerException" %>
 <%@ page import="org.wso2.usermanager.UserStoreAdmin" %>
+<%@ page import="org.wso2.utils.ServerConfiguration" %>
 <%@ page import="org.wso2.wsas.ServerManager" %>
+<%@ page import="javax.crypto.Cipher" %>
+<%@ page import="javax.crypto.KeyGenerator" %>
+<%@ page import="javax.crypto.SecretKey" %>
 <%@ page import="javax.servlet.ServletContext" %>
 <%@ page import="java.io.BufferedReader" %>
 <%@ page import="java.io.FileReader" %>
 <%@ page import="java.net.URL" %>
 <%@ page import="java.net.URLDecoder" %>
-<%@ page import="java.util.*" %>
-<%@ page import="org.wso2.utils.ServerConfiguration" %>
+<%@ page import="java.util.ArrayList" %>
+<%@ page import="java.util.Date" %>
+<%@ page import="java.util.Iterator" %>
+<%@ page import="java.util.List" %>
+<%@ page import="java.util.Map" %>
 <%
     Registry registry = RegistryUtils.getRegistry(request);
     // required by header.jsp
@@ -86,25 +103,44 @@
 
                 
request.getSession().setAttribute(MashupConstants.USER_REGISTRY, 
secureRegistry);
 
-                //Checking whether the user has opted to remember the session
-                if (rememberMe.equalsIgnoreCase("true")) {
-                    ServerConfiguration serverConfig = 
ServerConfiguration.getInstance();
-                    String rememberMeDays =
-                            
serverConfig.getFirstProperty(MashupConstants.SESSION_MANAGEMENT + "." +
-                                    MashupConstants.REMEMBER_ME_PERIOD);
-
-                    if (rememberMeDays != null) {
-                        int days = Integer.parseInt(rememberMeDays);
-                        //Storing the original timeout to be reset at logout
-                        
request.getSession().setAttribute(MashupConstants.ORIGINAL_INACTIVE_INTERVAL, 
request.getSession().getMaxInactiveInterval());
+                ServerConfiguration serverConfig = 
ServerConfiguration.getInstance();
+                String rememberPeriod =
+                        
serverConfig.getFirstProperty(MashupConstants.SESSION_MANAGEMENT + "." +
+                                MashupConstants.REMEMBER_ME_PERIOD);
+                if (rememberPeriod != null) {
+                    int numDays = 0;
+                    try {
+                        numDays = Integer.parseInt(rememberPeriod);
+                    } catch (NumberFormatException e) {
+                    }
+                    int expireIn = 60 * 60 * 24 * numDays;
+
+                    // Check if the user is active - if not, fail login.
+                    if (ManageUsers.isUserActive(secureRegistry, 
nameProvided)) {
+
+                        //Checking whether the user has opted to remember the 
session
+                        if (rememberMe.equalsIgnoreCase("true")) {
+                            //Saving the remember me option
+                            Cookie rememberMeCookie = new Cookie("rememberMe", 
rememberMe);
+                            rememberMeCookie.setMaxAge(expireIn);
+                            response.addCookie(rememberMeCookie);
+
+                            Cookie usernameCookie = new Cookie("username", 
nameProvided);
+                            usernameCookie.setMaxAge(expireIn);
+                            usernameCookie.setSecure(true);
+                            response.addCookie(usernameCookie);
+
+                            // Encode the password
+                            Cookie passwordCookie = new Cookie("password",
+                                                               new 
sun.misc.BASE64Encoder().encode(
+                                                                       
passwordProvided.getBytes("UTF-8")));
+                            passwordCookie.setMaxAge(expireIn);
+                            passwordCookie.setSecure(true);
+                            response.addCookie(passwordCookie);
+                        }
 
-                        //Setting the new timeout according to the value 
configured in server.xml
-                        request.getSession().setMaxInactiveInterval(days * 24 
* 60 * 60);
                     }
-                }
 
-                // Check if the user is active - if not, fail login.
-                if (ManageUsers.isUserActive(secureRegistry, nameProvided)) {
                     response.sendRedirect(bounceback);
                 } else {
                     success = false;
@@ -132,13 +168,13 @@
 
     <script type="text/javascript" language="JavaScript">
 
-        function setRememberMe(){
+        function setRememberMe() {
             var val = document.getElementById("chkRemember").checked;
             var remMe = document.getElementById("rememberme");
 
-            if(val){
+            if (val) {
                 remMe.value = "true";
-            }else{
+            } else {
                 remMe.value = "false";
             }
         }
@@ -151,7 +187,7 @@
 
     <%@ include file="header.jsp" %>
     <div id="search"></div>
-    <div id="content">          
+    <div id="content">
         <table width="100%" height="400" border="0" cellspacing="0" 
cellpadding="5">
             <tr>
                 <td valign="top">
@@ -184,8 +220,11 @@
                                     <label style="margin-right:31px; 
"><strong>Password:</strong></label><input
                                         type="password" name="password" 
id="password"/>
                                     <br/><br/><br/>
+
                                     <div style="width:100%; text-align: left; 
"><input
-                                            type="checkbox" id="chkRemember" 
onclick="setRememberMe();"><label style="text-align: left; ">
+                                            type="checkbox" id="chkRemember"
+                                            onclick="setRememberMe();"><label
+                                            style="text-align: left; ">
                                         Remember me on this 
computer</label><br><br></div>
                                     <div style="width:100%; text-align: center 
"><input
                                             type="submit"

Modified: trunk/mashup/java/modules/www/signout.jsp
==============================================================================
--- trunk/mashup/java/modules/www/signout.jsp   (original)
+++ trunk/mashup/java/modules/www/signout.jsp   Wed Jan 16 08:30:09 2008
@@ -95,11 +95,24 @@
 
         request.getSession().setAttribute(MashupConstants.USER_REGISTRY, 
secureRegistry);
 
-        //Resetting the session timeout to the original value
-        request.getSession()
-                
.setMaxInactiveInterval((Integer)request.getSession().getAttribute(
-                        MashupConstants.ORIGINAL_INACTIVE_INTERVAL));
-        
+        //Deleting user login cookies
+        Cookie cookies[] = request.getCookies();
+
+        Cookie curCookie = null;
+        for (int x = 0; x < cookies.length; x++) {
+            curCookie = cookies[x];
+            if (curCookie.getName().equalsIgnoreCase("rememberMe")) {
+                curCookie.setMaxAge(0);
+                response.addCookie(curCookie);
+            } else if (curCookie.getName().equalsIgnoreCase("username")) {
+                curCookie.setMaxAge(0);
+                response.addCookie(curCookie);
+            } else if (curCookie.getName().equalsIgnoreCase("password")) {
+                curCookie.setMaxAge(0);
+                response.addCookie(curCookie);
+            }
+        }
+
         response.sendRedirect(bounceback);
 
     } catch (RegistryException e) {

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

Reply via email to