diff --git a/settings/Controller/AuthSettingsController.php b/settings/Controller/AuthSettingsController.php index 4e3d05a14e..732f3abd1f 100644 --- a/settings/Controller/AuthSettingsController.php +++ b/settings/Controller/AuthSettingsController.php @@ -111,7 +111,9 @@ class AuthSettingsController extends Controller { /** * @NoAdminRequired * @NoSubadminRequired + * @PasswordConfirmationRequired * + * @param string $name * @return JSONResponse */ public function create($name) { @@ -138,11 +140,11 @@ class AuthSettingsController extends Controller { $tokenData = $deviceToken->jsonSerialize(); $tokenData['canDelete'] = true; - return [ + return new JSONResponse([ 'token' => $token, 'loginName' => $loginName, - 'deviceToken' => $tokenData - ]; + 'deviceToken' => $tokenData, + ]); } private function getServiceNotAvailableResponse() { diff --git a/settings/js/authtoken_view.js b/settings/js/authtoken_view.js index 0939913cc1..c45e4b7ec4 100644 --- a/settings/js/authtoken_view.js +++ b/settings/js/authtoken_view.js @@ -299,6 +299,11 @@ }, _addAppPassword: function () { + if (OC.PasswordConfirmation.requiresPasswordConfirmation()) { + OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this._addAppPassword, this)); + return; + } + var _this = this; this._toggleAddingToken(true);