some error handling in case the recovery password is wrong
This commit is contained in:
parent
9d1e60325c
commit
8ae30891b3
2 changed files with 9 additions and 2 deletions
|
@ -28,10 +28,13 @@ if(is_null($userstatus)) {
|
|||
exit();
|
||||
}
|
||||
|
||||
// Return Success story
|
||||
if(!is_null($password) && OC_User::setPassword( $username, $password, $recoveryPassword )) {
|
||||
$util = new \OCA\Encryption\Util(new \OC_FilesystemView('/'), \OCP\User::getUser());
|
||||
if ( $recoveryPassword && ! $util->checkRecoveryPassword($recoveryPassword) ) {
|
||||
OC_JSON::error(array("data" => array( "message" => "Wrong recovery admin password. Please check the password and try again." )));
|
||||
}elseif(!is_null($password) && OC_User::setPassword( $username, $password, $recoveryPassword )) {
|
||||
OC_JSON::success(array("data" => array( "username" => $username )));
|
||||
}
|
||||
else{
|
||||
OC_JSON::error(array("data" => array( "message" => "Unable to change password" )));
|
||||
}
|
||||
error_log("bliub");
|
||||
|
|
|
@ -357,6 +357,10 @@ $(document).ready(function () {
|
|||
OC.filePath('settings', 'ajax', 'changepassword.php'),
|
||||
{username: uid, password: $(this).val(), recoveryPassword: recoveryPasswordVal},
|
||||
function (result) {
|
||||
if (result.status != 'success') {
|
||||
OC.dialogs.alert(result.data.message,
|
||||
t('settings', 'Error changing password'));
|
||||
}
|
||||
}
|
||||
);
|
||||
input.blur();
|
||||
|
|
Loading…
Reference in a new issue