Skip to content
Snippets Groups Projects
Commit 8ae30891 authored by Björn Schießle's avatar Björn Schießle
Browse files

some error handling in case the recovery password is wrong

parent 9d1e6032
No related branches found
No related tags found
No related merge requests found
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment