@@ -7,6 +7,7 @@ import type { AxiosResponse } from '@nextcloud/axios'
77import  type  {  Node  }  from  '@nextcloud/files' 
88import  type  {  StorageConfig  }  from  '../services/externalStorage' 
99
10+ import  {  addPasswordConfirmationInterceptors ,  PwdConfirmationMode  }  from  '@nextcloud/password-confirmation' 
1011import  {  generateUrl  }  from  '@nextcloud/router' 
1112import  {  showError ,  showSuccess ,  spawnDialog  }  from  '@nextcloud/dialogs' 
1213import  {  translate  as  t  }  from  '@nextcloud/l10n' 
@@ -18,6 +19,10 @@ import { FileAction, DefaultType } from '@nextcloud/files'
1819import  {  STORAGE_STATUS ,  isMissingAuthConfig  }  from  '../utils/credentialsUtils' 
1920import  {  isNodeExternalStorage  }  from  '../utils/externalStorageUtils' 
2021
22+ // Add password confirmation interceptors as 
23+ // the backend requires the user to confirm their password 
24+ addPasswordConfirmationInterceptors ( axios ) 
25+ 
2126type  CredentialResponse  =  { 
2227	login ?: string , 
2328	password ?: string , 
@@ -31,8 +36,13 @@ type CredentialResponse = {
3136 * @param  password The password 
3237 */ 
3338async  function  setCredentials ( node : Node ,  login : string ,  password : string ) : Promise < null | true >  { 
34- 	const  configResponse  =  await  axios . put ( generateUrl ( 'apps/files_external/userglobalstorages/{id}' ,  {  id : node . attributes . id  } ) ,  { 
35- 		backendOptions : {  user : login ,  password } , 
39+ 	const  configResponse  =  await  axios . request ( { 
40+ 		method : 'PUT' , 
41+ 		url : generateUrl ( 'apps/files_external/userglobalstorages/{id}' ,  {  id : node . attributes . id  } ) , 
42+ 		confirmPassword : PwdConfirmationMode . Strict , 
43+ 		data : { 
44+ 			backendOptions : {  user : login ,  password } , 
45+ 		} , 
3646	} )  as  AxiosResponse < StorageConfig > 
3747
3848	const  config  =  configResponse . data 
0 commit comments