Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once 'core/init.php';
- $user_data = $user->get_data( session::get('username'));
- $errors = array();
- if( Input::get('changepass') ){
- if( token::show( Input::get('token') ) ){
- $validation = new Validation();
- // 2. metode check
- $validation = $validation->check(array(
- 'password' => array( 'required' => true ),
- 'password_baru' => array(
- 'required' => true,
- 'min' => 3,
- ),
- 'repassword' => array(
- 'required' => true,
- 'match' => 'password_baru'
- )
- ));
- // 3. lolos ujian
- if ( $validation->passed() ){
- if( password_verify(Input::get('password'), $user_data['password']) ){
- $user->update_user(array(
- 'password' => password_hash(Input::get('password_baru'), PASSWORD_DEFAULT)
- ), $user_data['id']);
- }else{
- $errors[] = 'password lama anda salah';
- }
- }else{
- $errors = $validation->errors();
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement