【发布时间】:2025-12-25 06:55:16
【问题描述】:
伙计们!
我目前正在开发一个基于 Symfony 2.8 和一些 Sonata-Project 捆绑包的项目。目标是实现两因素身份验证(也称为两步验证)。我看到 Sonata-Project 有一个用于实现此类功能的包并安装了它。然后根据sonata's documentation 配置app/config/config.yml 文件,但是当我尝试从登录表单登录我的仪表板时,我这样做没有任何进一步的障碍(没有 2-Factor Authentication Prompt)。在这里,在 *.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。
【问题讨论】:
标签: sonata-admin sonata symfony-sonata symfony-2.8 sonata-user-bundle