Advertisement
Guest User

Untitled

a guest
Mar 9th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. <?php
  2. $userEmail = 'test@test.com';
  3. $userPassword = '123456';
  4.  
  5. // Using Doctrine for example
  6. $user = $repository->findByEmail($userEmail);
  7.  
  8. if(password_verify($userPassword, $user->getPassword())){
  9. $options = ['cost' => 10];
  10. if(password_needs_rehash($user->getPassword(), PASSWORD_DEFAULT, $options)){
  11. $hash = password_hash($userPassword, PASSWORD_DEFAULT, $options);
  12. // save $hash as a NEW password on database
  13. }
  14. // DO LOGIN
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement