Win a copy of Java 9 Modularity: Patterns and Practices for Developing Maintainable Applications this week in the Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

One user login problem...  RSS feed

 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi all,

I am developing one struts 2 application.
My problm is...
The user can log in only once...
I meant to say once the user is logged in.. he/she can't login again from any other computer.. .

How can I come to know this user has been alredy logged in... ?

Please help me....

Thanks you...
 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, why would you want to do that.

Consider a scenario where the user logged in from home computer but forgot to logout.
Now, the same user comes to office and tries to login to your application, he is locked out now, because your application would not allow him to login.

Is this really what you want?

Perhaps, you should invalidate the previous login of the same user, if the user logs in again from some place else.
 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
James Ward wrote:Well, why would you want to do that.

Consider a scenario where the user logged in from home computer but forgot to logout.
Now, the same user comes to office and tries to login to your application, he is locked out now, because your application would not allow him to login.

Is this really what you want?

Perhaps, you should invalidate the previous login of the same user, if the user logs in again from some place else.


Thanks James...

but I am aware of this scenario.... but in yahoo mail the same thing happens.. while in google one user can login multipal times form anywhere.... I wanted to know how to keep common session so that I can know this user is alredy in session...
 
James Ward
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Keep the list of logged in users in database or in a static HashTable etc.

If same user logs in from multiple places, and you want to allow this, that user will get two different sessions.


 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks James....

Thank you so much...
 
Ankit Garg
Sheriff
Posts: 9610
37
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm a little unsure whether you want to allow the same user to login from to different locations or not. If you want to allow it, then you don't need to do anything special for that...
 
Sanket L Shah
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

No i dont want use to login form another location...
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So check to see if they're logged in. If they are, don't allow them to log in again.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!