You need to sign in to do that
Don't have an account?
Swapnil
Site.login problem
I am using Site.login with the start Url as null. Once the user is successfully logged in I want to redirect it to some page. I need to check if the user is successfully logged in or not? I am currently checking if the Site.login return null then it is unsuccessful. And then I try to redirect.
The page is getting redirected but the user is not logged in. How can I check if the user is actually logged in.....
If you don't pass the start url after login user will be taken to the site home page.
If you pass the start url and if the login is successful then user will be taken there if the login is not successful then visitor will remain on the same page.
so you have two options
1- if site login fails then visitor will remain on the same page and won't be redirected to the start url. So you might want to pass the start url
2- don't pass start url and check on the user type on the site home page. If the user type is 'Guest' then it means anonymous access. But this might mean that you won't be caching the home page. I would recommend option 1.
The problem with option 1 is that I cannot pass more than 1 parameter to the startUrl. So after successful login I will create my own new URL and will redirect the user to that page. Thats what I have thought.
If there is any way to pass more than 1 parameter to the startUrl I don't need to do all this. Please let me know what you think about this and thanks for your reply.
can you try passing more than parameters again? It was a bug that the fixed is deployed last night.
Sure I will try that right away..... Will respond with what I find.
It did not work for me. It is still taking just 1 parameter.
Do I need to refresh my org or something to get the updated org. I dont think so but still making it sure....
no changes required on your side. We'll look in to this and post an update
Swapnil - can you provide more information?
I just tried:
and it redirected me to
http://mysite.force.com/home/home.jsp?a=1&b=2&c=3
If you are using the StartURL like this:
with a URL like:
http://mysite.force.com/SiteLogin?startURL=/home/home.jsp?a=1&b=2&c=3
Then System.currentPageReference().getParameters().get('startURL') is going to return "/home/home.jsp?a=1" and not "/home/home.jsp?a=1&b=2&c=3" like you might expect (because those are treated as different query parameters). To get the values of b and c you would get to use:
So I tried
String startUrl = '/hompage?a=' + value_a + '&b=' value_b;
site.login(username, pwd, startUrl);
It just logged in with the 1st parameter. value_a and value_b are dynamic values which I want in my url.
I tried this as well
Even today I tried with Ryan's solution but the result is same the page is redirected correctly but with only 1st parameter.
So what I thought was after successful login I will create a new pagereference where I want it to land. But this approach took me to the correct page but the user didnt get logged in.
I think this problem has come back after Summer 10 release. Has anyone else experienced it again?
We are experiencing this issue again. Has any one else experienced this issue after Summer 10 release?
@zaidy - Is the site on one of NA1, NA6, or NA7? Those are the instances that have been upgraded this past Friday evening. Did you encounter this problem before Friday?
Hi Addison,
We didn't have this problem before Friday (day time UK), it appeared on Saturday (UK time) just after the upgrade. We are on NA7 and were aware of the upgrade happening on Friday night USA time.