CakePHP的验证函数:$ this-> Auth-> loginError消息 [英] Cakephp Auth: $this->Auth->loginError message

查看:154
本文介绍了CakePHP的验证函数:$ this-> Auth-> loginError消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的验证组件。我的beforeFilter设置$这个 - > Auth-> loginError。不过,我还有一个posibility。如果用户输入的用户名和密码是正确的,但User.status ='待定'我怎样才能可以显示不同的信息。我使用$这个 - > Auth-> userScope来设置。但如何表现出不同的$这个 - > Auth-> loginError这两个posibilities。

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. 的用户名和密码=正确的,但状态=未决

  2. 无论是用户名或密码不正确=而状态=有效

有两个posibilities。

there are the two posibilities.

推荐答案

检查出的 autoRedirect财产

如果你设置为false,你可以在控制器您正在使用的身份验证模式添加一些额外的逻辑来登录方法。在这里,你可以为帐户状态的检查和为活动提供自定义消息与待处理帐户。你必须在方法手动设置重定向时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.

这篇关于CakePHP的验证函数:$ this-> Auth-> loginError消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆