简体   繁体   English

symfony 3 FOSUserBundle Bcrypt密码哈希器

[英]symfony 3 FOSUserBundle Bcrypt password hasher

does anybody know how brypt hashes for passwords, used in Symfony 3 with FOSUser Bundle (default parameters) can be generated (online service or php function(preferred))? 有谁知道如何brypt密码(Symfony 3中使用FOSUser Bundle(默认参数)的密码的哈希加密)(在线服务或php函数(首选))? For example, for password 111 I have the following hash: $2y$13$zGCO1RyfbDZovNY9tWOETuXuG/NghlNqimTICEI1r15podQMOp.e2 例如,对于密码111我具有以下哈希值: $2y$13$zGCO1RyfbDZovNY9tWOETuXuG/NghlNqimTICEI1r15podQMOp.e2

I have tried several online generators but still could not reproduce this hash. 我已经尝试了几种在线生成器,但仍然无法复制此哈希。 Any Ideas? 有任何想法吗? Is it possible to use hash generated 'separately' from Symfony? 是否可以使用从Symfony“单独”生成的哈希? Thank you 谢谢

When a tried to execute it from Controller this was the result: 当尝试从Controller执行它时,结果是:

[Symfony\\Component\\Console\\Exception\\CommandNotFoundException] There are no commands defined in the "fos:user" namespace. [Symfony \\ Component \\ Console \\ Exception \\ CommandNotFoundException]在“ fos:user”名称空间中没有定义命令。

the command is not a service or is not public(by fos_user) IDK. 该命令不是服务或不是公共的(由fos_user)IDK。

I did it this way 我是这样做的

    public function changePasswordAction(Request $request){
        ...
        $manipulator = $this->get('fos_user.util.user_manipulator');
        $manipulator->changePassword('jimorales', '123');
        ...
        return new Response('password changed!');
    }

before/after you can add your own logig 您可以添加自己的logig之前/之后

Hope it helps!! 希望能帮助到你!!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM