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

site login authentication when redirected from other website


I have already built site login page and some pages after that with Customer Portal enabled. 
Now I have a requirement wherein if a user is already loggedin so he should be redirected to page2 else to page 1.
With little digging I have found that by checking (UserInfo.getUserType() != 'guest') we can check if the user is loggedin or not.

But my main concern is that: If I am getting redirected from some other website/webpage to my SFDC site and
        if the user
             - is already logged in then he should get redirect to the page2.i.e. if the same browser is used for redirecting to SDFC site so with the same session Id he should be logged in into my portal.
             - else to page 1 where he has to fill some information ........... and do some tasks

Please let me know if some further information is required.

I have done something similar to solution of and it is working fine if I am playing around only at my SFDC site, but I am not able to handle if I getting redirected from some other website to my site.