Last active
March 9, 2017 21:42
-
-
Save adelarcubs/a5e3c5506a4c8c9f3670312ee01a266b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$userEmail = '[email protected]'; | |
$userPassword = '123456'; | |
// Using Doctrine for example | |
$user = $repository->findByEmail($userEmail); | |
if(password_verify($userPassword, $user->getPassword())){ | |
$options = ['cost' => 10]; | |
if(password_needs_rehash($user->getPassword(), PASSWORD_DEFAULT, $options)){ | |
$hash = password_hash($userPassword, PASSWORD_DEFAULT, $options); | |
// save $hash as a NEW password on database | |
} | |
// DO LOGIN | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment