Cakephp Auth: $this->Auth->loginError message

给你一囗甜甜゛ 提交于 2019-12-11 02:34:09

问题


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:


Check out the autoRedirect property

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.



来源:https://stackoverflow.com/questions/3900615/cakephp-auth-this-auth-loginerror-message

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!