0

I am working with laravel auth and resetting password using ResetsPasswords Trait with SHA512 encryption here is my code of ResetPassowrds trait

/**
 * Reset the given user's password.
 *
 * @param  \Illuminate\Contracts\Auth\CanResetPassword  $user
 * @param  string  $password
 * @return void
 */
protected function resetPassword($user, $password)
{
    $user->password = hash('sha512',$password);

    $user->setRememberToken(Str::random(60));

    $user->save();

    event(new PasswordReset($user));

    $this->guard()->login($user);
}

code is working properly in local but when i switch to server the password got updated in bcrypt how to resolve this...?

Ankita Mehta
  • 442
  • 3
  • 16
  • use Illuminate\Support\Facades\Hash; and then $user->password = Hash::make($password); Not SHA512 but should work. – Brad Goldsmith Sep 21 '18 at 14:12
  • @BradGoldsmith but i need to convert it in SHA512 not in bcrypt. – Ankita Mehta Sep 24 '18 at 04:48
  • https://laracasts.com/discuss/channels/laravel/encrypt-sha512 https://stackoverflow.com/questions/18305789/correctly-using-crypt-with-sha512-in-php . Maybe these links will help. Sorry I could not have been more assistance. – Brad Goldsmith Sep 24 '18 at 12:06

0 Answers0