Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. <?php
  2. require_once 'core/init.php';
  3.  
  4.  
  5. $user_data = $user->get_data( session::get('username'));
  6. $errors = array();
  7.  
  8. if( Input::get('changepass') ){
  9. if( token::show( Input::get('token') ) ){
  10.  
  11. $validation = new Validation();
  12.  
  13. // 2. metode check
  14. $validation = $validation->check(array(
  15. 'password' => array( 'required' => true ),
  16. 'password_baru' => array(
  17. 'required' => true,
  18. 'min' => 3,
  19. ),
  20. 'repassword' => array(
  21. 'required' => true,
  22. 'match' => 'password_baru'
  23. )
  24. ));
  25.  
  26. // 3. lolos ujian
  27. if ( $validation->passed() ){
  28. if( password_verify(Input::get('password'), $user_data['password']) ){
  29.  
  30. $user->update_user(array(
  31. 'password' => password_hash(Input::get('password_baru'), PASSWORD_DEFAULT)
  32. ), $user_data['id']);
  33. }else{
  34. $errors[] = 'password lama anda salah';
  35. }
  36.  
  37. }else{
  38. $errors = $validation->errors();
  39. }
  40.  
  41. }
  42. }
  43.  
  44.  
  45. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement