views:

35

answers:

1

I am using Auth Component. I am setting $this->Auth->loginError in the beforeFilter. But i have another posibility. If the user entered username and password is correct but User.status = 'pending' how can i can show a different message. i am using $this->Auth->userScope to set that. but how to show different $this->Auth->loginError for these two posibilities.

  1. Username and Password = correct but Status = pending
  2. Either Username or Password = incorrect but status = active

there are the two posibilities.

+1  A: 

Check out the autoRedirect property: http://book.cakephp.org/view/395/autoRedirect

If you set this to false, you can add some additional logic to the login method in the controller for the model you're using for authentication. Here you can make the check for the account status and deliver the custom message for the active vs. pending accounts. You'll have to set redirects manually in the method when autoRedirect is off.

whelanska