summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorskjnldsv <skjnldsv@protonmail.com>2025-02-19 17:17:00 +0100
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-03-06 07:47:41 +0000
commitedead7274b26d398268031e7c8b633ed75ada6ed (patch)
tree10cb5eded65ae01b280fc701be1e9286a5dd162b /apps
parent0721bea60622d379888feaff2cd4ed55b3069ae3 (diff)
downloadnextcloud-server-edead7274b26d398268031e7c8b633ed75ada6ed.tar.gz
nextcloud-server-edead7274b26d398268031e7c8b633ed75ada6ed.zip
fix(files_external): request strict password auth on credentials enter action
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_external/src/actions/enterCredentialsAction.ts14
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/files_external/src/actions/enterCredentialsAction.ts b/apps/files_external/src/actions/enterCredentialsAction.ts
index 20821298db5..50698d1e83a 100644
--- a/apps/files_external/src/actions/enterCredentialsAction.ts
+++ b/apps/files_external/src/actions/enterCredentialsAction.ts
@@ -7,6 +7,7 @@ import type { AxiosResponse } from '@nextcloud/axios'
import type { Node } from '@nextcloud/files'
import type { StorageConfig } from '../services/externalStorage'
+import { addPasswordConfirmationInterceptors, PwdConfirmationMode } from '@nextcloud/password-confirmation'
import { generateUrl } from '@nextcloud/router'
import { showError, showSuccess, spawnDialog } from '@nextcloud/dialogs'
import { translate as t } from '@nextcloud/l10n'
@@ -18,6 +19,10 @@ import { FileAction, DefaultType } from '@nextcloud/files'
import { STORAGE_STATUS, isMissingAuthConfig } from '../utils/credentialsUtils'
import { isNodeExternalStorage } from '../utils/externalStorageUtils'
+// Add password confirmation interceptors as
+// the backend requires the user to confirm their password
+addPasswordConfirmationInterceptors(axios)
+
type CredentialResponse = {
login?: string,
password?: string,
@@ -31,8 +36,13 @@ type CredentialResponse = {
* @param password The password
*/
async function setCredentials(node: Node, login: string, password: string): Promise<null|true> {
- const configResponse = await axios.put(generateUrl('apps/files_external/userglobalstorages/{id}', { id: node.attributes.id }), {
- backendOptions: { user: login, password },
+ const configResponse = await axios.request({
+ method: 'PUT',
+ url: generateUrl('apps/files_external/userglobalstorages/{id}', { id: node.attributes.id }),
+ confirmPassword: PwdConfirmationMode.Strict,
+ data: {
+ backendOptions: { user: login, password },
+ },
}) as AxiosResponse<StorageConfig>
const config = configResponse.data