summaryrefslogtreecommitdiffstats
path: root/settings/src
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-11-12 11:54:56 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-11-12 11:59:38 +0100
commit1cb5f316ed2113b1a546bb9a3daea1d5fe207785 (patch)
tree18979356ef7ec14e1d844b10147c043e35b73f62 /settings/src
parentd6de8ebeb272d677a4bf1930c6eb42c1bf57b844 (diff)
downloadnextcloud-server-1cb5f316ed2113b1a546bb9a3daea1d5fe207785.tar.gz
nextcloud-server-1cb5f316ed2113b1a546bb9a3daea1d5fe207785.zip
Use nextcloud-password-confirmation
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src')
-rw-r--r--settings/src/store/api.js33
1 files changed, 3 insertions, 30 deletions
diff --git a/settings/src/store/api.js b/settings/src/store/api.js
index 5bab785d94b..185e80253a3 100644
--- a/settings/src/store/api.js
+++ b/settings/src/store/api.js
@@ -1,4 +1,4 @@
-/*
+/**
* @copyright Copyright (c) 2018 John Molakvoæ <skjnldsv@protonmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
@@ -21,6 +21,7 @@
*/
import axios from 'nextcloud-axios'
+import confirmPassword from 'nextcloud-password-confirmation'
const sanitize = function(url) {
return url.replace(/\/$/, ''); // Remove last url slash
@@ -60,35 +61,7 @@ export default {
* @returns {Promise}
*/
requireAdmin() {
- return new Promise(function(resolve, reject) {
- // TODO: migrate the OC.dialog to Vue and avoid this mess
- // wait for password confirmation
- let passwordTimeout;
- let waitForpassword = function() {
- if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
- passwordTimeout = setTimeout(waitForpassword, 500);
- return;
- }
- clearTimeout(passwordTimeout);
- clearTimeout(promiseTimeout);
- resolve();
- };
-
- // automatically reject after 5s if not resolved
- let promiseTimeout = setTimeout(() => {
- clearTimeout(passwordTimeout);
- // close dialog
- if (document.getElementsByClassName('oc-dialog-close').length>0) {
- document.getElementsByClassName('oc-dialog-close')[0].click();
- }
- OC.Notification.showTemporary(t('settings', 'You did not enter the password in time'));
- reject('Password request cancelled');
- }, 7000);
-
- // request password
- OC.PasswordConfirmation.requirePasswordConfirmation();
- waitForpassword();
- });
+ return confirmPassword();
},
get(url) {
return axios.get(sanitize(url));