You need to sign in to do that
Don't have an account?
BNB Balu
How To create a Login page in Visualforce?how to create login and register new id's?how to save those register id's and passwords?
How To create a Login page in Visualforce?how to create login and register new id's?how to save those register id's and passwords?
When I click REGISTER Button, it needs to redirect to another Visualforce page, in that page i need to have fields such as: FirstName, LastName, Email Id, Password and Confirm Password.
when I click Login:if match login id and password corret login to new page.otherwise display login id or password error.
When I click REGISTER Button, it needs to redirect to another Visualforce page, in that page i need to have fields such as: FirstName, LastName, Email Id, Password and Confirm Password.
when I click Login:if match login id and password corret login to new page.otherwise display login id or password error.
VF page:
<apex:page controller="LoginSignUpController">
<apex:form >
<apex:pageBlock >
<apex:pageBlockSection >
<apex:inputField id="name" value="{!student.User_Name__c}" required="true"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField id="age" value="{!student.Roll_No__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:outputLabel value="password" for="pass"/>
<apex:inputSecret id="pass" value="{!student.Password__c}" required="true"/>
</apex:pageBlockSectionItem>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField id="gender" value="{!student.mobile__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField id="gender" value="{!student.EmailId__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField id="gender" value="{!student.Gender__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField id="birthday" value="{!student.Birthday__c}"/>
</apex:pageBlockSection>
<apex:pageBlockSection >
<apex:inputField id="birthday" value="{!student.Department__c}"/>
</apex:pageBlockSection>
<apex:commandButton value="signup" action="{!signUp}"/>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller :
public class LoginSignUpController {
public Student__c student{get;set;} //Assume it to be ur custom user
public LoginSignUpController()
{
student=new Student__c();
}
public PageReference login()
{
if( (student.shivamindtree__EmailId__c == null) || (student.shivamindtree__Password__c == null))
{
return null;
}
List<Student__c> students= [select Id,shivamindtree__EmailId__c,shivamindtree__Password__c from Student__c];
for(Student__c loginStudent:students)
{
if((loginStudent.shivamindtree__EmailId__c == student.shivamindtree__EmailId__c) && (loginStudent.shivamindtree__Password__c == student.shivamindtree__Password__c))
{
PageReference page = new PageReference('/apex/UserStart');
page.getParameters().put('studentId', loginStudent.Id);
page.setRedirect(true);
return page;
}
}
return null;
}
public PageReference signUp()
{
insert student;
PageReference pageRef = new PageReference(ApexPages.currentPage().getUrl());
pageRef.setRedirect(true);
return pageRef;
}
}
Modify your code based on your requirement. Let me know if you need further help.
Thanks and Regards,
Shiva RV