function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
chaitanya Krishna 19chaitanya Krishna 19 

Site Controllers

Hi team,

i am trying to combine both site login and site registration controller in a single controller.

But my login button on vf page is not working at all. i hope i did mistake in apex.

global with sharing class PortalSiteController {                     
global String username {get; set;}                 
global String password {get; set;}               
  global String Firstname {get; set;}                
 global String LastName {get; set;}                 
global String email {get; set;}                 
private static Id PORTAL_ACCOUNT_ID = '001x000xxx35tPN';     
global PortalSiteController () {                    
global PageReference login() {                                 
String startUrl = System.currentPageReference().getParameters().get('startURL');                                 return Site.login(username, password, startUrl);                                

global PageReference registerUser() {                                                                        
 User u = new User();                                 
u.Username = LastName;                                
 u.CommunityNickname= Firstname;                                 
u.Email = email;                                                                          
String accountId = PORTAL_ACCOUNT_ID;                                        
 String userId = Site.createPortalUser(u, accountId);                                         
 if (userId != null)                                          
PageReference page = System.Page.SiteRegisterConfirm;                                        
 return page;                                        
  return null;                                        

Can any one help me on this.. i am new to coding so.. and what we should mention in starturl.... i am not able to understand the use of starturl..

please help me in this