伙计们!
我目前正在基于Symfony 2.8和一些Sonata-Project捆绑包构建项目。目标是实现两因素身份验证(又称为两步验证)。我看到Sonata-Project有一个用于实现这种功能的软件包,并安装了它。然后根据sonata's documentation配置app/config/config.yml
文件,但是当我尝试从登录表单登录到仪表板时,这样做没有任何其他障碍(没有2要素身份验证提示)。在这里,在stackoverflow.com上,我看到了一些与问题相关的答案(并非完全与之相关),这些答案建议运行php app/console sonata:user:two-step-verification *ADMIN_USER_NAME*
。我试图在终端中运行此命令,但引发了此异常:
[Symfony\Component\Debug\Exception\UndefinedMethodException]
Attempted to call an undefined method named "getTwoStepVerificationCode" of class
"Application\Sonata\UserBundle\Entity\User".
这里似乎是什么问题?为什么这种方法不存在?我该如何解决这个问题?
P.S .:我尝试将此Google-Authenticator软件包与Soanata-Project的UserBundle结合使用,it is "a feature" (if I may call it such) of the latter。
答案 0 :(得分:0)
您的应用程序是否正确扩展了Sonata\UserBundle\Entity\BaseUser
?因为如果没有,您将遇到这个问题。检查您的课程Application\Sonata\UserBundle\Entity\User
。