File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change @@ -1488,30 +1488,37 @@ window.addEventListener('DOMContentLoaded', function() {
1488
1488
}
1489
1489
} ) ;
1490
1490
1491
- $ ( '#global_credentials' ) . on ( 'submit' , function ( ) {
1492
- var $form = $ ( this ) ;
1491
+ function _submitCredentials ( success ) {
1493
1492
var uid = $form . find ( '[name=uid]' ) . val ( ) ;
1494
1493
var user = $form . find ( '[name=username]' ) . val ( ) ;
1495
1494
var password = $form . find ( '[name=password]' ) . val ( ) ;
1496
- var $submit = $form . find ( '[type=submit]' ) ;
1497
- $submit . val ( t ( 'files_external' , 'Saving …' ) ) ;
1498
1495
$ . ajax ( {
1499
1496
type : 'POST' ,
1500
1497
contentType : 'application/json' ,
1501
1498
data : JSON . stringify ( {
1502
- uid : uid ,
1503
- user : user ,
1504
- password : password
1499
+ uid,
1500
+ user,
1501
+ password,
1505
1502
} ) ,
1506
1503
url : OC . generateUrl ( 'apps/files_external/globalcredentials' ) ,
1507
1504
dataType : 'json' ,
1508
- success : function ( ) {
1505
+ success,
1506
+ } ) ;
1507
+ }
1508
+
1509
+ $ ( '#global_credentials' ) . on ( 'submit' , function ( ) {
1510
+ var $form = $ ( this ) ;
1511
+ var $submit = $form . find ( '[type=submit]' ) ;
1512
+ $submit . val ( t ( 'files_external' , 'Saving …' ) ) ;
1513
+
1514
+ window . OC . PasswordConfirmation
1515
+ . requirePasswordConfirmation ( ( ) => _submitCredentials ( function ( ) {
1509
1516
$submit . val ( t ( 'files_external' , 'Saved' ) ) ;
1510
1517
setTimeout ( function ( ) {
1511
1518
$submit . val ( t ( 'files_external' , 'Save' ) ) ;
1512
1519
} , 2500 ) ;
1513
- }
1514
- } ) ;
1520
+ } ) ) ;
1521
+
1515
1522
return false ;
1516
1523
} ) ;
1517
1524
Original file line number Diff line number Diff line change 10
10
use OCA \Files_External \Lib \Auth \PublicKey \RSA ;
11
11
use OCP \AppFramework \Controller ;
12
12
use OCP \AppFramework \Http \Attribute \NoAdminRequired ;
13
+ use OCP \AppFramework \Http \Attribute \PasswordConfirmationRequired ;
13
14
use OCP \AppFramework \Http \JSONResponse ;
14
15
use OCP \IGroupManager ;
15
16
use OCP \IRequest ;
@@ -71,6 +72,7 @@ public function getSshKeys($keyLength = 1024) {
71
72
* @return bool
72
73
*/
73
74
#[NoAdminRequired]
75
+ #[PasswordConfirmationRequired]
74
76
public function saveGlobalCredentials ($ uid , $ user , $ password ) {
75
77
$ currentUser = $ this ->userSession ->getUser ();
76
78
if ($ currentUser === null ) {
You can’t perform that action at this time.
0 commit comments