I am allowing two types of login on the website Site Account and Facebook User..
For the facebook user the password field will be empty.
so i do a query like this in the login action to find out if the user is a facebook user.
if(!empty($this->data)){
$this->User->recursive = -1;
$facebook_user = $this->User->find('count', array('conditions' => array('email' => $this->data['User']['email'], 'password' => null)));
if($facebook_user == 1){
$this->Auth->loginError = "Looks like you have used Facebook connect to Login to the website.";
}
}
if the $facebook_user == 1 then i want the particular LoginError to be displayed.
As default i am setting LoginError in the before Filter to
$this->Auth->loginError = "Please check the Username and Passwords";
But the facebook LoginError doesnt get assigned even if $facebook_user is set to 1
BeforeFilter in Users Controller
function beforeFilter() {
$this->Auth->fields = array('username' => 'email', 'password' => 'password');
$this->Auth->loginRedirect = array('controller' => 'users', 'action' => 'harsha');
$this->Auth->logoutRedirect = array('controller' => 'users', 'action' => 'killer');
$this->Auth->loginError = "Please check the Username and Passwords";
$this->Auth->authError = "You are not authorized to be here Bitch.";
$this->Auth->allow('*');
}
BeforeFilter() in App Controller
function beforeFilter() {
$this->Auth->allow('*');
//$this->Auth->userScope = array('User.status' => 'active');
// Setting Admin Template
if(isset($this->params['admin'])) {
$this->layout = 'admin';
}
}