Skip to content

Commit c9d7bce

Browse files
committed
fix(apppasswords): Require password also on delete and update
Signed-off-by: Joas Schilling <coding@schilljs.com>
1 parent d28bfb4 commit c9d7bce

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

apps/settings/lib/Controller/AuthSettingsController.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ private function checkAppToken(): bool {
173173
* @return array|JSONResponse
174174
*/
175175
#[NoAdminRequired]
176+
#[PasswordConfirmationRequired(strict: true)]
176177
public function destroy($id) {
177178
if ($this->checkAppToken()) {
178179
return new JSONResponse([], Http::STATUS_BAD_REQUEST);
@@ -201,6 +202,7 @@ public function destroy($id) {
201202
* @return array|JSONResponse
202203
*/
203204
#[NoAdminRequired]
205+
#[PasswordConfirmationRequired(strict: true)]
204206
public function update($id, array $scope, string $name) {
205207
if ($this->checkAppToken()) {
206208
return new JSONResponse([], Http::STATUS_BAD_REQUEST);

apps/settings/src/store/authtoken.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export const useAuthTokenStore = defineStore('auth-token', {
7777
* @param token Token to update
7878
*/
7979
async updateToken(token: IToken) {
80-
const { data } = await axios.put(`${BASE_URL}/${token.id}`, token)
80+
const { data } = await axios.put(`${BASE_URL}/${token.id}`, token, { confirmPassword: PwdConfirmationMode.Strict })
8181
return data
8282
},
8383

@@ -111,7 +111,7 @@ export const useAuthTokenStore = defineStore('auth-token', {
111111
this.tokens = this.tokens.filter(({ id }) => id !== token.id)
112112

113113
try {
114-
await axios.delete(`${BASE_URL}/${token.id}`)
114+
await axios.delete(`${BASE_URL}/${token.id}`, { confirmPassword: PwdConfirmationMode.Strict })
115115
logger.debug('App token deleted')
116116
return true
117117
} catch (error) {

0 commit comments

Comments
 (0)