Create a login page using visualforce with apex error message.
public class loginPageController {
public list res {set;get;}
public string resName{set;get;}
public string firstName{set;get;}
public string LastName {set;get;}
public string password {set;get;}
public string reTypePassword {set;get;}
public string phone {set; get;}
public string Email {set;get;}
public loginpage(){
res= new list();
}
public pagereference getpage(){
res=[select name,FirstName__c,LastName__c,password__c,Retype_Password__c,phone__C,Email__C from Registration__c where Email__C=:Email];
if(Email != null && res.size()>0){
apexpages.Message mes= new apexpages.Message(apexpages.Severity.ERROR,'Please check your username and password');
apexpages.addMessage(mes);
return null;
}else{
Registration__c r = new Registration__c();
r.Name=resName;
r.lastName__c=LastName;
r.FirstName__c=firstName;
r.Email__c=Email;
r.Retype_Password__c=reTypePassword;
r.Password__c=Password;
r.Phone__c=phone;
insert r;
pagereference p = new pagereference('/'+r.Id);
return p;
}
}
public pagereference GetRecord(){
pagereference page = new pagereference('/apex/forgetLinkPage');
return page;
}
public pagereference LadingHomePage(){
pagereference hpage = new pagereference('/apex/Ladingpage');
return hpage;
}
public pagereference HomepageEnter(){
pagereference newpage = new pagereference('/apex/NewHome');
newpage.setRedirect(true);
return newpage;
}
}
Name
Last Name:
First Name:
Phone:
Email:
Password:
Retype password: