This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes Servlets and the fly likes How to ristrict multiple login's at the same time using same username? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "How to ristrict multiple login Watch "How to ristrict multiple login New topic
Author

How to ristrict multiple login's at the same time using same username?

sumit jagtap
Greenhorn

Joined: Dec 08, 2011
Posts: 19
All,

I have to prevent multiple user logins to my web application developed in JSP,Servlet

I used following tricks

I have maintain Table for user and password .that table to add one more column loginstatus . whenever he/she login change flag yes .when logout change flag no. when the user going to login know that time just check the status .if flag no(N) then allow user otherwise do not allow .

The solution above seems to be work, but some cases the logged user does not click on logout button! So, the session in this case will be expired, and if the user will try logon again will receive error. How can I handle this case?

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56541
    
  14

Record the user as logged out when the session expires using a session listener.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
sumit jagtap
Greenhorn

Joined: Dec 08, 2011
Posts: 19
can you please explain in details or example?
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 1322
    
    8

Look at the java docs for HTTPSessionListener

You should change the status of the user when the session is destroyed. Note that if the user doesn't logout, the session will be destroyed only after the web server times the session out. So, there will be a period of time where the user's account will be locked
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: How to ristrict multiple login's at the same time using same username?
 
Similar Threads
PATIDAR JANAK
Restricting multiple logins
Invalidating user session on browser window close
Browser Closing without signout from site
Prevent multiple logins