FOS用户捆绑包:更改密码期间,列“ salt”不能为空

时间:2018-08-23 10:46:38

标签: fosuserbundle symfony-3.4

以前,该应用程序的版本为PHP7.0,SF 3.1和FOS / UserBundle 2.0。

在使用SF 3.4和FOS / UserBundle 2.1迁移到PHP7.2之后,在更改密码期间,我遇到了以下问题:

$ bin/console fos:user:change-password toto pass1234

SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null" ["exception" => Doctrine\DBAL\Exception\NotNullConstraintViolationException { …},"command" => "fos:user:change-password toto pass1234","message" => """  An exception occurred while executing 'UPDATE fos_user SET salt = ?, password = ? WHERE id = ?' with params [null, "$2y$13$LOb\/************************************wof0QpTGGpzGi", 2]:\n  \n  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null  """] []

In AbstractMySQLDriver.php line 123:

  An exception occurred while executing 'UPDATE fos_user SET salt = ?, password = ? WHERE id = ?' with params [null, "$2y$13$LOb\/************************************wof0QpTGGpzGi", 2]:                                            

  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null                                                                      


In PDOStatement.php line 144:

  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null                                                                      


In PDOStatement.php line 142:

  SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'salt' cannot be null                                                                      


fos:user:change-password [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> <username> <password>

1 个答案:

答案 0 :(得分:0)

解决了!

我编辑了文件app/config/security.yml,并用security.encoders.FOS\UserBundle\Model\UserInterface替换了bcrypt(即argon2i)的值。

然后我清除了缓存,重试了,然后就可以了!

https://symfony.com/doc/current/reference/configuration/security.html#reference-security-argon2i