我有一个针对数据库进行用户身份验证的应用程序。我使用的属性是电子邮件:
providers:
administrators:
entity:
class: CorabMainBundle:User
property: email
身份验证效果很好!但是我在让记住我的功能正常工作时遇到了很大的问题。几个小时后,我想我找到了问题,但我不知道如何解决它......
Symfony2 似乎尝试使用用户名而不是电子邮件进行身份验证,以防记住我。
dev.log 说以下内容:
[2013-10-21 23:49:19] security.DEBUG: Remember-me cookie detected. [] []
[2013-10-21 23:49:19] doctrine.DEBUG: SELECT t0.id AS id1, t0.username AS username2, t0.salt AS salt3, t0.password AS password4, t0.email AS email5, t0.is_active AS is_active6, t0.organisation AS organisation7 FROM User t0 WHERE t0.email = ? LIMIT 1 ["roger"] []
[2013-10-21 23:49:19] security.INFO: User for remember-me cookie not found. [] []
[2013-10-21 23:49:19] security.DEBUG: Clearing remember-me cookie "REMEMBERME" [] []
第 2 行不行,因为它不应该是roger而是一个电子邮件地址。这就是cookie被删除的原因。
如何告诉 symfony2 使用电子邮件作为属性来记住我的身份验证?
谢谢您的帮助!