some error handling in case the recovery password is wrong

This commit is contained in:
Björn Schießle 2013-05-16 15:19:53 +02:00
parent 9d1e60325c
commit 8ae30891b3
2 changed files with 9 additions and 2 deletions

View file

@ -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");

View file

@ -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();