Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $userEmail = 'test@test.com';
- $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
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement