• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

RememberMe on login page

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !!
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Sudhanshu Shanker Singh
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the link I posted doesn't help, then unfortunately, I don't know any more than that. Sorry.

Mark
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic