function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VempallyVempally 

How to Achieve Login and Logout functionalities

Hi Everyone...

What is the logic behind the login and logout functionalities...

Thank you...
Naveen Rahul 3Naveen Rahul 3

in your apex class u need to add either in controller or any method.

public username {get,set}
public password {get,set}
Site.login(username,password);
String userinfo=Site.userInfo();

userinfo will be having current logged in user details
 

 

for logout add the below code in your apex page


<a href="{!$Site.Prefix}/secur/logout.jsp">logout</a>
 

Swagato RaySwagato Ray
Hi,

The log in and logout is depends upon session management. When a user logged in ,then a session(A object) is created for that user . That same user when loggs out ,destroys the session(it is done autometically, through code).In between  log in and logout everything can be stored in the "Session" object and can be used latter on.

if it helps .Pleases mark it.

Regards
Swagata