You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Priya Saloni <sa...@gmail.com> on 2005/12/29 16:03:01 UTC

How to remember usernames?

Hi there,

I have a requirement like this where i need to remember the user names for a
computer.Can some one suggest me how to implement this using struts based
framework..

Example:

  *Username: *   *Password: *   Remember my BCP username.

Thanks In Advance

Priya

RE: How to remember usernames?

Posted by Daniel Blumenthal <da...@wordchamp.com>.
> On 12/29/05, Priya Saloni <sa...@gmail.com> wrote:
> >
> > Hi there,
> >
> > I have a requirement like this where i need to remember the 
> user names 
> > for a computer.Can some one suggest me how to implement this using 
> > struts based framework..
> >
> > Example:
> >
> >   *Username: *   *Password: *   Remember my BCP username.
> 
> 
> You could use a cookie to store the username on the users computer.
> It is saved by the browser actually so if the user logs in 
> with IE and then with Mozilla, Mozilla won't know about the 
> cookie set in IE.
> 
> Look at the servlet API:
> 
> javax.servlet.http.Cookie
> javax.servlet.http.HttpServletRespone.addCookie(Cookie)
> javax.servlet.http.HttpServletResponse.getCookies()

Also, there's a good LGPL javascript library that has all the important
cookie functions (as well as a ton of other goodies) here:
http://cross-browser.com/

If you want to let the user auto-login (assuming it's not a site on which
security is critical), then a common thing to do is to store the username as
one cookie, and a HASH of username+password as another.  It's important not
to just store the password in plaintext, or a hash of the password alone
(because there are dictionaries of hashes of 8 or 9 characters available).

Best,
Daniel




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: How to remember usernames?

Posted by Tamas Szabo <sz...@gmail.com>.
Hi!

On 12/29/05, Priya Saloni <sa...@gmail.com> wrote:
>
> Hi there,
>
> I have a requirement like this where i need to remember the user names for
> a
> computer.Can some one suggest me how to implement this using struts based
> framework..
>
> Example:
>
>   *Username: *   *Password: *   Remember my BCP username.


You could use a cookie to store the username on the users computer.
It is saved by the browser actually so if the user logs in with IE and then
with
Mozilla, Mozilla won't know about the cookie set in IE.

Look at the servlet API:

javax.servlet.http.Cookie
javax.servlet.http.HttpServletRespone.addCookie(Cookie)
javax.servlet.http.HttpServletResponse.getCookies()



Thanks In Advance


Hope it helps

Priya
>
> Tamas