I have a custom page Create ticket and I want to host it on Sites. I am using partner credentials to log into sites. Once I enter partner credentials, it's always logging in with Guest User. How would I access the partner user in my Controller? We are displaying the related contacts/accounts based on login partner user on sites.
global with sharing class SiteLoginController {
global String username {get; set;}
global String password {get; set;}
global PageReference login() {
pageReference ticketing = new pageReference('/apex/TETicketing');
pagereference TETicketing = Site.login(username, password, '/TETicketing');
if(TETicketing != null ){
ticketing.setRedirect(true);
return ticketing;
}
else
return site.login(username, password, null);
}
}
Leveraged standard sitelogin page, modified cls
public PageReference login() {
PageReference portalPage = new PageReference('/apex/ticketVFpage');
portalPage.setRedirect(true);
PageReference vResult = Site.login(username, password, '/ticketVFpage');
if (vResult == null){
return Site.login(username, password, null);
} else {
return portalPage;
//If authentication is successfull return to ticketVFpage page(ticketVFpage).
}
}
This is how we are authenticating users using partner portal credentials. After login instead of getting the logged in user info we are getting guest user info.