aspose file tools*
The moose likes Other Application Frameworks and the fly likes RememberMe on login page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "RememberMe on login page" Watch "RememberMe on login page" New topic
Author

RememberMe on login page

Sudhanshu Shanker Singh
Greenhorn

Joined: Jan 05, 2009
Posts: 2
Hi All,

This is my first post so let me start off with my introduction. I am software Engg. In my current project which is based on Springs and ACEGI i needed to implement "RememberMe" option on the login page.

For this i have created a .js file with javascript functions to save,delete and get cookies. In the Login page on "onSubmit" i am calling the following functions of "login.js":

onsubmit="saveUsername(this);savePassword(this);sa veCheckBoxCookie(this);return validateForm(this)"

And hence saving three cookies. And i am saving cookies only if the checkbox is checked otherwise i am simply deleting the cookies. My login.js is:



The functions to set, delete and get cookies are in "global.js".


My loginForm.jsp is:



Everything works perfectly fine but the problem is that the cookies are remembered i.e the username and password can be seen filled only for approx an hour. After one hour the username and password cookies gets Everything works perfectly fine but the problem is that the cookies are remembered i.e the username and password can be seen filled only for approx an hour. After one hour the username and password cookies gets deleted. This is very strange. And the strange thing is that the checkbox cookie does not get deleted it can be seen there in the browser.

Although the cookies life is set to 30 days.


I think this is because of ACEGI. ACEGI security is doing something that i am not able to resolve.
I am new to Springs and ACEGI.

Please help !!
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

Um, if you are using Spring Security, the current name for what was Acegi.

Anyway, in Spring Security you have an xml file that has all the <intercept-url>. When you set this up, you set up the Filter Chain too. You can modify or add to the filter chain. One of the options in the xml is for remember me, so you don't have to go through all that trouble to set it up. Why go and write all that Javascript.

Well here is the doc page for remember me
http://static.springframework.org/spring-security/site/reference/html/remember-me.html

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Sudhanshu Shanker Singh
Greenhorn

Joined: Jan 05, 2009
Posts: 2
Hi Mark, Thank you for the reply.

I have the following requirements:

1) When the user opens the Login page for the first time the Checkbox will be unchecked.

2) Once the user has checked the “RememberMe” Checkbox it will remain checked till the time user unchecks it. Even if the user opens a new browser it will remain checked.


3) If the “RememberMe” Checkbox is checked, Next time when user opens the Login page the text boxes will be filled by the correct Username and the Password that user has entered earlier. Even if the user closes the current window and opens a new one the credentials can be seen filled there.

4) If the user unchecks the “RememberMe” Checkbox the credentials will be no longer can be seen filled there.


5) If the user enters wrong credentials then that will not be remembered.

6) If the user after successful login closes the browser without logging out from the “mainMenu.jsp”, Next time when the user opens the login page he does not need to login again, in fact will be logged in automatically.

This application is already built by using Appfuse. Its not like i have written all this javascript code. I have just made some additions into that.

I just do not understand why the username and password cookies are getting deleted after some time say approx one hour. And the strange part is that the checkbox cookies is not deleted. Although the life is set to 30 days.
And only using the filter will not fullfill all these requirements.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17259
    
    6

If the link I posted doesn't help, then unfortunately, I don't know any more than that. Sorry.

Mark
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: RememberMe on login page