Return the user object from login() so that we can act upon a user's

authentication immediately following a successful login.


git-svn-id: https://samskivert.googlecode.com/svn/trunk@75 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2001-03-02 02:45:48 +00:00
parent 8198fc6fb4
commit 04f1a83125
@@ -1,5 +1,5 @@
// //
// $Id: UserManager.java,v 1.2 2001/03/02 02:08:50 mdb Exp $ // $Id: UserManager.java,v 1.3 2001/03/02 02:45:48 mdb Exp $
package com.samskivert.servlet.user; package com.samskivert.servlet.user;
@@ -141,8 +141,10 @@ public class UserManager
* was established and the proper cookies were set in the supplied * was established and the proper cookies were set in the supplied
* response object. If invalid authentication information is provided * response object. If invalid authentication information is provided
* or some other error occurs, an exception will be thrown. * or some other error occurs, an exception will be thrown.
*
* @return the user object of the authenticated user.
*/ */
public void login (String username, String password, public User login (String username, String password,
HttpServletResponse rsp) HttpServletResponse rsp)
throws SQLException, NoSuchUserException, InvalidPasswordException throws SQLException, NoSuchUserException, InvalidPasswordException
{ {
@@ -162,6 +164,8 @@ public class UserManager
acookie.setPath("/"); acookie.setPath("/");
acookie.setMaxAge(24*60*60); // expire in two days acookie.setMaxAge(24*60*60); // expire in two days
rsp.addCookie(acookie); rsp.addCookie(acookie);
return user;
} }
public void logout (HttpServletRequest req, HttpServletResponse rsp) public void logout (HttpServletRequest req, HttpServletResponse rsp)