You need to sign in to do that
Don't have an account?
Login method invoking error
Hi Guys,
I am trying to do a simple authentication for portal user.I have written a login method and trying to call it from a VF command button.In the debug logs i get a following statement after entering username and password.Its not redirecting to the startUrl mentioned in site.login() call.
09:27:23.073 (73933217)|VF_APEX_CALL|submit|{!login}|PageReference: none
Following is the controller code :
public class MobileSiteLoginController {
public String username {get; set;}
public String password {get; set;}
public User tempUser{get; set;}
public String startUrl{get;set;}
public PageReference login() {
String startUrl = System.currentPageReference().getParameters().get('/MobileAppPage1');
System.debug('-----username----'+ username);
System.debug('-----Password----'+ password);
System.debug('-----Start URL---'+ startUrl);
return Site.login(username, password, startUrl);
}
public MobileSiteLoginController () { }
}
Please let me know if i am doing anything wrong.
Thanks,
Gaurav
I am trying to do a simple authentication for portal user.I have written a login method and trying to call it from a VF command button.In the debug logs i get a following statement after entering username and password.Its not redirecting to the startUrl mentioned in site.login() call.
09:27:23.073 (73933217)|VF_APEX_CALL|submit|{!login}|PageReference: none
Following is the controller code :
public class MobileSiteLoginController {
public String username {get; set;}
public String password {get; set;}
public User tempUser{get; set;}
public String startUrl{get;set;}
public PageReference login() {
String startUrl = System.currentPageReference().getParameters().get('/MobileAppPage1');
System.debug('-----username----'+ username);
System.debug('-----Password----'+ password);
System.debug('-----Start URL---'+ startUrl);
return Site.login(username, password, startUrl);
}
public MobileSiteLoginController () { }
}
Please let me know if i am doing anything wrong.
Thanks,
Gaurav
can you try this and see if it works
public PageReference login() {
String startUrl = System.currentPageReference().getParameters().get('/MobileAppPage1');
System.debug('-----username----'+ username);
System.debug('-----Password----'+ password);
System.debug('-----Start URL---'+ startUrl);
PageReference p = Site.login(username, password, startUrl);
if (p!=null)
p.setRedirect(true);
return p;
}
I modified the controller as above.But i still get the same logs mentioned in previous comment and the page is not redirected to the mentioned start URL.
Could you please try to remove extra "/" before "MobileAppPage1" parameter..
like :
String startUrl = System.currentPageReference().getParameters().get('MobileAppPage1');
May be this will work.
Thanks!!
I tried to remove the extar '/' but in the logs i get startUrl as null.
Have i missed anything in the settings abt the portal and the sites.
Thanks,
Gaurav