Created
October 31, 2014 16:37
-
-
Save DB-009/1688139ef479b561cdec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if($validator->fails()){ | |
return Response::json(['error' => 1, | |
'msg'=>$validator->errors() | |
]); | |
} | |
else{ | |
$user = User::find(Input::get('user_id')); | |
$curpass = $user->password; | |
$pass = Hash::make(Input::get('password')); | |
$npass = Hash::make(Input::get('npassword')); | |
if(Hash::check($pass,$curpass)){ | |
if(!Hash::check($curpass,$npass)){ | |
$user ->password=Hash::make(Input::get('npassword')); | |
$user->save(); | |
///SUCCESS | |
return Response::json(['success' =>1,'msg'=>'The user '.Input::get('username') .' has been updated!','action' => 'users/search_users']); | |
} | |
else{ | |
return Response::json(['error' => 2, | |
'msg'=>'Cannot use Current password as New password']); | |
} | |
} | |
///FAILED | |
return Response::json(['error' => 3, | |
'msg'=>'The password you entered was incorrect']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment