Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: joist/java/org/joist/session SessionManager.java

Project highlights: Architectural Overview

joist
Discussion topic

Back to topic list

CVS update: joist/java/org/joist/session SessionManager.java

Author anoncvs
Full name anonymous CVS access
Date 2000-11-05 18:08:13 PST
Message User: jrobbins
  Date: 00/11/05 18:08:13

  Modified: java/org/joist/session SessionManager.java
  Log:
  added ability to identify oneself with email address
  
  Revision Changes Path
  1.18 +37 -9 joist/java/org/joist​/session/SessionMana​ger.java
  
  Index: SessionManager.java
  ====================​====================​====================​=======
  RCS file: /cvs/joist/java/org/​joist/session/Sessio​nManager.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SessionManager.java 2000/11/04 04:35:06 1.17
  +++ SessionManager.java 2000/11/06 02:08:13 1.18
  @@ -69,7 +69,7 @@
     * Manages information cached in the session.
     *
     * @author David C. Pellegrini <A HREF="mailto:davidp@​dataweb-systems.com"​>davidp@dataweb-s​ystems.com</A>​
  - * @version $Revision: 1.17 $
  + * @version $Revision: 1.18 $
     *
     * Copyright (c) 1999 dataweb systems, inc.
     * Copyright (c) 1999, 2000 Collab.Net, Inc.
  @@ -363,13 +363,13 @@
        *
        * @param connection a JDBC connection
        * @param context the WebContext
  - * @param loginID the user's login ID
  + * @param identify the user's login ID or email address
        * @param password the user's password
        * @return A variable of type boolean
        * @exception SQLException
        */
       public boolean loginIsValid(Connection connection, WebContext context,
  - String loginID, String password) throws SQLException
  + String identify, String password) throws SQLException
       {
           Statement stmt = null;
   
  @@ -378,9 +378,9 @@
           try
           {
               StringBuffer selectStmt = new StringBuffer(
  - "select name, userID, email from User where loginID=");
  + "select name, userID, email, loginID from User where loginID=");
               selectStmt.append(Qu​otedString.from(
  - EscapedString.from(l​oginID.trim())));
  + EscapedString.from(i​dentify.trim())));
               selectStmt.append(" and password=PASSWORD(");
               selectStmt.append(Qu​otedString.from(
                           EscapedString.from(p​assword.trim())));
  @@ -394,7 +394,7 @@
                   setUserName(rset1.ge​tString(1));
                   setUserID(rset1.getString(2));
                   setEmail(rset1.getString(3));
  - setLoginID(loginID);
  + setLoginID(rset1.getString(4));
   
                   // Put the user's name, ID and email into the context
                   context.put("UserName", userName);
  @@ -407,9 +407,37 @@
               }
               else
               {
  - // The login id and password did not retrieve any User,
  - // so the login fails.
  - isLoggedIn = Boolean.FALSE;
  + selectStmt = new StringBuffer("select name, userID, email, loginID from User where email=");
  + selectStmt.append(Qu​otedString.from(Esca​pedString.from(ident​ify.trim())));
  + selectStmt.append(" and password=PASSWORD(");
  + selectStmt.append(Qu​otedString.from(Esca​pedString.from(passw​ord.trim())));
  + selectStmt.append(");");
  +
  + stmt = connection.createStatement();
  +
  + rset1 = stmt.executeQuery(se​lectStmt.toString())​;
  + if (rset1.next())
  + {
  + setUserName(rset1.ge​tString(1));
  + setUserID(rset1.getString(2));
  + setEmail(rset1.getString(3));
  + setLoginID(rset1.getString(4));
  +
  + // Put the user's name, ID and email into the context
  + context.put("UserName", userName);
  + context.put("loginUserID", userID);
  + context.put("email", email);
  + context.put("loginID", loginID);
  +
  + // Record that a successful login has occurred
  + isLoggedIn = Boolean.TRUE;
  + }
  + else
  + {
  + // The login id and password did not retrieve any User,
  + // so the login fails.
  + isLoggedIn = Boolean.FALSE;
  + }
               }
           }
           catch (Exception e)

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: joist/java/org/joist/session SessionManager.java anoncvs anonymous CVS access 2000-11-05 18:08:13 PST
Messages per page: