Salesforce : Extranet site with SalesForce.com users authentication
I would like to create an extranet with Force.com Sites pages with an authentication that allow access to my SalesForce.com users.
The FAQ indicates that it is possible : http://wiki.developerforce.com/index.php/Sites_FAQ
I tried with http://wiki.developerforce.com/index.php/Authenticating_Users_on_Force.com_Sites, but that only allow customers to login and 开发者_运维知识库it redirects to the customer portal.
But, what I need is to authenticate SalesForce.com users on Force.com Sites. Any Idea ? Is there a way to do this ?
The wiki page you referenced (http://wiki.developerforce.com/index.php/Authenticating_Users_on_Force.com_Sites) is the way to go here, just change the following code snippet:
public class SiteLoginController {
public String username {get; set;}
public String password {get; set;}
public PageReference login() {
String startUrl = '/my_site_homepage'; // change the startUrl
return Site.login(username, password, startUrl);
}
public SiteLoginController () {}
public static testMethod void testSiteLoginController () {
// Instantiate a new controller with all parameters in the page
SiteLoginController controller = new SiteLoginController ();
controller.username = 'test@salesforce.com';
controller.password = '123456';
System.assertEquals(controller.login(),null);
}
}
As you can see in the PageReference login
you have a startUrl
just change that to the page you want to load after the login.
精彩评论