Guest User

Untitled

a guest
Dec 13th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. public function changePassword(){
  2.  
  3. // Generate new Password
  4. $newPassword = bin2hex(openssl_random_pseudo_bytes(16/2, $crypto));
  5.  
  6. $user = Auth::user();
  7.  
  8. $user->password = bcrypt($newPassword);
  9.  
  10. $user->save();
  11.  
  12. if(Hash::check($newPassword, $user->password)){
  13.  
  14. return response($user);
  15.  
  16. }
  17.  
  18. return response('Password Mismatched', 401);
  19. }
Add Comment
Please, Sign In to add comment