You need to sign in to do that
Don't have an account?
Authentication Problem
My site home page has a button, onclick of which it should goto my custom login screen.
The problem is when i click the button, instead of going to my custom login page, it goes
to native error page saying.
Authorization Required
ou must first log in or register before accessing this page.
If you have forgotten your password, click Forgot Password to reset it.
Below is the code i am using
VF
---
<apex:page showHeader="false" controller="SanjuCntrl">
<apex:form >
<apex:commandButton action="{!loginPage}" value="Enter" id="theButton" image="{!$Resource.mylogo}"/>
</apex:form>
</apex:page>
Controller
-----------
public class SanjuCntrl{
public PageReference loginPage() {
PageReference pr = Page.SanjuLogin;
pr.setredirect(true);
return pr;
}
}
I want to authorise user only in the secon page (ie My custom login screen).
Thanks
Sanju
1. Is the page titled SanjuLogin enabled as part of the Site? If it is not enabled as part of the Site, it requires authentication to access it.
2. If the username and password passed into the Site.Login method are correct for a Portal User associated to the Portal which is associated to the Site, then the user will be redirected to the 3rd parameter, startURL, passed into the site.login call. So set the 'startURL' parameter to your custom login page.
All Answers
I havent got the solution for above problem, but
as of now i have made the my home VF page to custom login page.
My custom loginpage with controller SiteLoginController.
In the SiteLoginController the authentication method is gven as
My question would be
1. From this method how will i know whether User is a valid user or not?
2.If valid user how would i re-direct user to the custom welcome pag?
Thanks in advance.
1. Is the page titled SanjuLogin enabled as part of the Site? If it is not enabled as part of the Site, it requires authentication to access it.
2. If the username and password passed into the Site.Login method are correct for a Portal User associated to the Portal which is associated to the Site, then the user will be redirected to the 3rd parameter, startURL, passed into the site.login call. So set the 'startURL' parameter to your custom login page.
Thanks for that information.
> Now i have set my Active Site Home Page to SanjuLogin.So when you type the site url, SanjuLoginpage is displayed.
> The problem is, even after giving the valid user name (my user id & password), even after being a system
administrator, it still shows me the error message.
Does it mean that force.com id and portal user id are different?
If it is so, how would i add myself as a portal user?
What i want to do exactly is
1. User will type the site url
2. Custom Login page (SanjuLogin) is displayed
3. User provides his userid & password and submits.
4. If userid valid, then go to custom menu (sanju) page
else display the error message in login page itself.
Here is my current code
SanjuLogin VF Page
SiteLoginController apex class
Lets first verify that you are logging in as a Portal User.
Once you have enabled a Customer Portal, create a Contact and then click on the "Enable Customer Portal User" button on the Contact Detail page layout. It will take you to the User creation page and complete that form (probably makes sense to set the email address to your email so you get the 'reset password'email notifications). Reset the password, then try your Force.com Site Login page again.
It worked! Thank you so much. I been trying it for two days now.
Now i know you have add a user in Contacts, and then enable it for portal
inorder to access our site.
The next problem is for this portal user, custom objects are not getting displayed?
For eg. i have a custom object BlogPost__c. I need to display the data in my
custom page sanju.
Each custom object has a property to enable it for use within customer portal. Make sure that is checked. Go to the custom object definition (Setup | Create | Objects) and click edit next to the specific object(s) you want to enable for the portal.
Next, each portal user is associated a portal profile. Make sure that profile has the proper CRUD permissions to the objects you need. Go to Setup | Administration Setup | Manage Users | Profiles to see the profiles.
It all worked out fine.
Thanks for all your support.
One more doubt i have.
I have a link in my VF page
This link takes the user to edit page.
But when the link is clicked it shows the message
http://sanju-developer-edition.na6.force.com/sanju/ is under construction
Stay tuned. Please email us if you need to get in touch.
I have observed that, when page transition is done through
controller using PageReference, the page transits correctly
but if we call the page directly without using controller
method, then native page is getting displayed saying
"under construction".
What will the possible cause?