Skip to content

Commit 002d9b2

Browse files
Merge pull request #59602 from nextcloud/bugfix/noid/require-password-confirmation-on-delete
fix(apppasswords): Require password also on delete and update
2 parents e9cd2fc + 60d1111 commit 002d9b2

4 files changed

Lines changed: 7 additions & 5 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) {

dist/settings-vue-settings-personal-security.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/settings-vue-settings-personal-security.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)