Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
edited title
Link
Hect1c
  • 155
  • 1
  • 9

System Site.Login is not successfully logging and redirecting the user

Source Link
Hect1c
  • 155
  • 1
  • 9

System Site.Login

We have a community site where we allow guest users to log in using self registration.

In our controller we confirm the user, activate the user account and attempt to log them in using the

PageReference pr = Site.login(email, password, url);
pr.setRedirect(true);
return pr;

We have a system.debug to see the redirect url. The issue is that unfortunately the user is not logged in, and is just redirected to the community login page.

In the debug of the pr variable, we copy the string provided and enter that in the browser which seems to successfully log us in and redirect us, so the url from the pagerefence is correct. However, as previously stated in the normal flow this process does not seem to take place and instead of being logged in and redirected the user is just redirected to the login page. Has anyone else ran into such issue? What could be the cause of this redirect, knowing that the redirect url is correct? Everything from what I can tell looks good and we aren't getting any exception errors.