Hello Readers,
If you want to login the cakephp application using the email or username and password
Use the below code:
$username=$REQUEST['login'];
$email=$REQUEST['login'];
$password=$REQUEST['password'];
Here $REQUEST be the superglobal variable
if($email && $password){
$user = $this->User->find("first", array(
"conditions" => array(
"User.email" => $email,"User.password"=>$password
)
)
);
}
elseif($username && $pass){
$user = $this->User->find("first", array(
"conditions" => array(
"User.username" => $username,"User.password"=>$password
)
)
);
}
The above code contain the email, username and password to login the application. And here we have used the find Method to filter the record according to email or username and password and using the if and elseif condition to check the user and password to login the application
0 Comment(s)