if ($result === true) {
$this->session->setStatus(Session::INIT_SUCCESSFUL);
return new DataResponse(
- ['data' => [
- 'status' => 'success',
- 'message' => (string) $this->l->t('Private key password successfully updated.'),
- ],
- ]
+ ['message' => (string) $this->l->t('Private key password successfully updated.')]
);
} else {
return new DataResponse(
- ['data' => [
- 'message' => (string) $errorMessage,
- ],
- ],
+ ['message' => (string) $errorMessage],
Http::STATUS_BAD_REQUEST
);
}
}
-
-
}
var newPrivateKeyPassword = $('input:password[id="newPrivateKeyPassword"]').val();
OC.msg.startSaving('#encryption .msg');
$.post(
- OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword')
- , { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
- , function( data ) {
- if (data.status === "error") {
- OC.msg.finishedSaving('#encryption .msg', data);
- } else {
- OC.msg.finishedSaving('#encryption .msg', data);
- }
- }
- );
+ OC.generateUrl('/apps/encryption/ajax/updatePrivateKeyPassword'),
+ { oldPassword: oldPrivateKeyPassword, newPassword: newPrivateKeyPassword }
+ ).success(function(response) {
+ OC.msg.finishedSuccess('#encryption .msg', response.message);
+ }).fail(function(response) {
+ OC.msg.finishedError('#encryption .msg', response.responseJSON.message);
+ });
}
$(document).ready(function(){
$this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
$this->assertSame('The current log-in password was not correct, please try again.',
- $data['data']['message']);
+ $data['message']);
}
/**
$this->assertSame(Http::STATUS_BAD_REQUEST, $result->getStatus());
$this->assertSame('The old password was not correct, please try again.',
- $data['data']['message']);
+ $data['message']);
}
/**
$this->assertSame(Http::STATUS_OK, $result->getStatus());
$this->assertSame('Private key password successfully updated.',
- $data['data']['message']);
+ $data['message']);
}
}