[英]Sonata-Project's Google Authenticator: Undefined Method “getTwoStepVerificationCode” from Application\Sonata\UserBundle\Entity\User
guys! 伙计们!
I am currently working on a project built on Symfony 2.8 and a few Sonata-Project bundles. 我目前正在基于Symfony 2.8和一些Sonata-Project捆绑包构建项目。 The goal is to achieve Two-Factor Authentication (aka Two-Step Verification).
目标是实现两要素身份验证(又称为两步验证)。 I saw that Sonata-Project has a package for implementing such functionality and installed it.
我看到Sonata-Project有一个用于实现这种功能的软件包,并安装了它。 Then configured the
app/config/config.yml
file according to sonata's documentation , but when I try to log into my Dashboard from the login form, I do that without any further obstacles (no 2-Factor Authentication Prompt). 然后根据
app/config/config.yml
的文档配置app/config/config.yml
文件,但是当我尝试从登录表单登录到仪表板时,我这样做没有任何其他障碍(没有2要素身份验证提示)。 Here, on stackoverflow.com, I've seen a few answers, (not-fully) related to my question, that suggest running php app/console sonata:user:two-step-verification *ADMIN_USER_NAME*
. 在这里,在stackoverflow.com上,我看到了一些答案(并非完全与我的问题有关),这些答案建议运行
php app/console sonata:user:two-step-verification *ADMIN_USER_NAME*
。 I've tried to run this command in my terminal, but got this exception thrown: 我尝试在终端中运行此命令,但引发了此异常:
[Symfony\Component\Debug\Exception\UndefinedMethodException]
Attempted to call an undefined method named "getTwoStepVerificationCode" of class
"Application\Sonata\UserBundle\Entity\User".
What seems to be the problem here? 这里似乎是什么问题? Why such method doesn't exist?
为什么这种方法不存在? How can I resolve this issue?
我该如何解决这个问题?
PS: I try to use this Google-Authenticator package in conjunction with Soanata-Project's UserBundle as it is "a feature" (if I may call it such) of the latter . PS:我尝试将此Google-Authenticator软件包与Soanata-Project的UserBundle结合使用,因为它是后者的“一项功能”(如果可以这样称呼) 。
Does your application properly extend Sonata\\UserBundle\\Entity\\BaseUser
? 您的应用程序是否正确扩展了
Sonata\\UserBundle\\Entity\\BaseUser
? Because if not you will have this issue. 因为如果没有,您将遇到这个问题。 Check your class
Application\\Sonata\\UserBundle\\Entity\\User
. 检查您的类
Application\\Sonata\\UserBundle\\Entity\\User
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.