Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/settings/lib/Controller/AuthSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function __construct(
* @return JSONResponse
*/
#[NoAdminRequired]
#[PasswordConfirmationRequired]
#[PasswordConfirmationRequired(strict: true)]
public function create($name) {
if ($this->checkAppToken()) {
return $this->getServiceNotAvailableResponse();
Expand Down
7 changes: 3 additions & 4 deletions apps/settings/src/store/authtoken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
import { showError } from '@nextcloud/dialogs'
import { loadState } from '@nextcloud/initial-state'
import { translate as t } from '@nextcloud/l10n'
import { confirmPassword } from '@nextcloud/password-confirmation'
import { addPasswordConfirmationInterceptors, confirmPassword, PwdConfirmationMode } from '@nextcloud/password-confirmation'
import { generateUrl } from '@nextcloud/router'
import { defineStore } from 'pinia'

import axios from '@nextcloud/axios'
import logger from '../logger'

const BASE_URL = generateUrl('/settings/personal/authtokens')
addPasswordConfirmationInterceptors(axios)

const confirm = () => {
return new Promise(resolve => {
Expand Down Expand Up @@ -84,9 +85,7 @@ export const useAuthTokenStore = defineStore('auth-token', {
logger.debug('Creating a new app token')

try {
await confirmPassword()

const { data } = await axios.post<ITokenResponse>(BASE_URL, { name })
const { data } = await axios.post<ITokenResponse>(BASE_URL, { name }, { confirmPassword: PwdConfirmationMode.Strict })
this.tokens.push(data.deviceToken)
logger.debug('App token created')
return data
Expand Down
Loading