Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how do you check if the user is logged in or not

 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone.....

Can anybody tell me how to check a user, if he is logged in or not.

I require this for my new page created in jsp.
If he is not logged in then i need to ask him to log in.


[originally posted on jforum.net by blutopaz_stein]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the user is logged in, the a call to



should return the string "1"

More information you can get by getting the UserSession instance that is in every session:



Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can u clarify the first method
[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What?

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nice

Rafael
[originally posted on jforum.net by Rafael Steil]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u rafael it worked.


[originally posted on jforum.net by blutopaz_stein]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rafael,
this is useful for me too. Thanks.

As a follow up, I have a Java webapp where users have to log in. I'm hoping to use JForum as an add on to this, but I don't want users to have to log in twice. I could use the JForum "users" table as the master users table (ie. migrate my existing users table), but what do I need to set in the session to fool JForum into thinking that the user has also logged into JForum? What attributes does your "UserSession" have? Is that the best way of doing this, or do you have any other suggestions?

thank for any tips.
Jim.

[originally posted on jforum.net by Anonymous]
 
Migrated From Jforum.net
Ranch Hand
Posts: 17424
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look in the method "checkCookies()", from JForum.java

Rafael
[originally posted on jforum.net by Rafael Steil]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic