Require confirmation when generating backup codes
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
a0d6c6593a
commit
86aa6197b8
|
@ -89,6 +89,11 @@
|
|||
}.bind(this));
|
||||
},
|
||||
_onGenerateBackupCodes: function () {
|
||||
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
||||
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this._onGenerateBackupCodes, this));
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide old codes
|
||||
this._enabled = false;
|
||||
this.render();
|
||||
|
|
|
@ -59,15 +59,17 @@ class SettingsController extends Controller {
|
|||
|
||||
/**
|
||||
* @NoAdminRequired
|
||||
* @PasswordConfirmationRequired
|
||||
*
|
||||
* @return JSONResponse
|
||||
*/
|
||||
public function createCodes() {
|
||||
$user = $this->userSession->getUser();
|
||||
$codes = $this->storage->createCodes($user);
|
||||
return [
|
||||
return new JSONResponse([
|
||||
'codes' => $codes,
|
||||
'state' => $this->storage->getBackupCodesState($user),
|
||||
];
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue