You need to sign in to do that
Don't have an account?
how to check login credentials are correct or not
how to check the user provided credentials(password and username) are correct or incorrect .
this is my page /////////////////////////////
<apex:page controller="Beaconlogin" sidebar="false" showHeader="false" id="page1">
<apex:form id="form1">
<table >
<tr>
<td><apex:outputText value="User id" style="color:Black;font-size:16px;font-weight:bold"/></td>
<td><apex:inputField value="{!login.User_id__c}" id="Userid2" style="color:Black;font-size:16px;font-weight:bold" /></td>
</tr>
<tr>
<td><apex:outputText value="Password" style="color:Black;font-size:16px;font-weight:bold"/></td>
<td><apex:inputsecret value="{!login.User_password__c}" id="Password2" style="color:Black;font-size:16px;font-weight:bold" /></td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td></td>
<td>
<apex:commandButton value="Login" action="{!login_check}" onclick="return logincheck()" id="Login"/></td>
</tr>
</table>
</apex:form>
</apex:page>
/////////////////////////////////controller ////////////////////////////////////
public with sharing class Beaconlogin {
public PageReference login_check() {
insert login;
pagereference ref = new pagereference('https://c.ap1.visual.force.com/apex/ApplicationForm');
ref.setredirect(true);
return ref;
}
public Beacon_login__c login { get; set; }
public Beaconlogin()
{
login= new Beacon_login__c();
}
}
Bind the Username and Password variables with controller and on click call the action.In controller,In action query the table where you are keeping track of all username and password to find out whether username and password exist or not. If exist then allow the user to login else show a login fault message on the page.
All Answers
Bind the Username and Password variables with controller and on click call the action.In controller,In action query the table where you are keeping track of all username and password to find out whether username and password exist or not. If exist then allow the user to login else show a login fault message on the page.
Hi Sagar,
Use this Class:
And this page :
--------------------
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Thanks
hi tejpal,
i think the solution u provided is for salesforce login , my requirement is for other site , if user exists he should redirect to another page(application form)
thanks
sagar
Hi Sagar,
This is the same for other Sites also. Use there Http Request.
Thanks
hi tejpal,
k thanks i vl try it with http request
hi,
my requirement is if user exists and if it is first login page should redirect to resetpassword , if login count is more than one page should redirect to application form . if user does not exists error msg should be added ,
after changing with query the record is not inserting ,
public Beacon_login__c loginc{ get; set; }
public PageReference login_check() {
login =[select id,User_id__c,User_password__c from Beacon_login__c ];
integer count=0;
count=[select count() from Beacon_login__c where id=:login.id ];
if(count==1)
{
loginc=[select id,isReset__c from Beacon_login__c where id=:loginc.id ];
if(loginc.isReset__c==false)
{
pagereference ref = new pagereference('https://c.ap1.visual.force.com/apex/Resetpassword');
ref.setredirect(true);
}
else
{
pagereference ref = new pagereference('https://c.ap1.visual.force.com/apex/ApplicationForm');
ref.setredirect(true);
}
}
else{
ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.INFO, 'User id or password are incorrect .'));
}
return null ;
}
public Beacon_login__c login { get; set; }
public Beaconlogin()
{
login= new Beacon_login__c();
}
vl u plz correct and give me object name is Beacon_login__c , fields are User_id__c,User_password__c
thanks
sagar
hi
uv
after binding and query i got it , thanks for ur idea
thanks
sagar