Laravel 4.2 Validation Rules - Current Password Must Match DB Value

后端 未结 1 2027
孤街浪徒
孤街浪徒 2021-02-08 23:00

On the password reset form the user supplies current_password, password and password-confirmation. Is there a way to specify in the valida

1条回答
  •  后悔当初
    2021-02-08 23:28

    You can't, bcrypt hashes are unique (they have their own random salt incorporated) so even if you knew the user's plain text password you would't be able do a hash-to-hash comparison.

    What you can do is actually check the plain text password against a bcrypt hash by doing Hash::check('plain text password', 'bcrypt hash') on your controller.

    0 讨论(0)
提交回复
热议问题