summaryrefslogtreecommitdiffstats
path: root/core/js/js.js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2019-01-31 18:41:06 +0100
committerChristoph Wurst <christoph@winzerhof-wurst.at>2019-02-01 08:24:13 +0100
commit9de02d326799285896e163cb7b6b1b47a1a5bbb9 (patch)
treedc513d4fc21e3b9d749cd9aaee68cadff9d796af /core/js/js.js
parentdbfa8b65a10105daa39333a5db655cc678b3b645 (diff)
downloadnextcloud-server-9de02d326799285896e163cb7b6b1b47a1a5bbb9.tar.gz
nextcloud-server-9de02d326799285896e163cb7b6b1b47a1a5bbb9.zip
Move OC.PasswordConfirmation to the server bundle
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/js/js.js')
-rw-r--r--core/js/js.js93
1 files changed, 0 insertions, 93 deletions
diff --git a/core/js/js.js b/core/js/js.js
index d2d5ce5a817..f82b7e9cec5 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -1309,99 +1309,6 @@ function initCore() {
OC.PasswordConfirmation.init();
}
-OC.PasswordConfirmation = {
- callback: null,
- pageLoadTime: null,
- init: function() {
- $('.password-confirm-required').on('click', _.bind(this.requirePasswordConfirmation, this));
- this.pageLoadTime = moment.now();
- },
-
- requiresPasswordConfirmation: function() {
- var serverTimeDiff = this.pageLoadTime - (nc_pageLoad * 1000);
- var timeSinceLogin = moment.now() - (serverTimeDiff + (nc_lastLogin * 1000));
-
- // if timeSinceLogin > 30 minutes and user backend allows password confirmation
- return (backendAllowsPasswordConfirmation && timeSinceLogin > 30 * 60 * 1000);
- },
-
- /**
- * @param {function} callback
- */
- requirePasswordConfirmation: function(callback, options, rejectCallback) {
- options = typeof options !== 'undefined' ? options : {};
- var defaults = {
- title: t('core','Authentication required'),
- text: t(
- 'core',
- 'This action requires you to confirm your password'
- ),
- confirm: t('core', 'Confirm'),
- label: t('core','Password'),
- error: '',
- };
-
- var config = _.extend(defaults, options);
-
- var self = this;
-
- if (this.requiresPasswordConfirmation()) {
- OC.dialogs.prompt(
- config.text,
- config.title,
- function (result, password) {
- if (result && password !== '') {
- self._confirmPassword(password, config);
- } else if (_.isFunction(rejectCallback)) {
- rejectCallback()
- }
- },
- true,
- config.label,
- true
- ).then(function() {
- var $dialog = $('.oc-dialog:visible');
- $dialog.find('.ui-icon').remove();
- $dialog.addClass('password-confirmation');
- if (config.error !== '') {
- var $error = $('<p></p>').addClass('msg warning').text(config.error);
- }
- $dialog.find('.oc-dialog-content').append($error);
- $dialog.find('.oc-dialog-buttonrow').addClass('aside');
-
- var $buttons = $dialog.find('button');
- $buttons.eq(0).hide();
- $buttons.eq(1).text(config.confirm);
- });
- }
-
- this.callback = callback;
- },
-
- _confirmPassword: function(password, config) {
- var self = this;
-
- $.ajax({
- url: OC.generateUrl('/login/confirm'),
- data: {
- password: password
- },
- type: 'POST',
- success: function(response) {
- nc_lastLogin = response.lastLogin;
-
- if (_.isFunction(self.callback)) {
- self.callback();
- }
- },
- error: function() {
- config.error = t('core', 'Failed to authenticate, try again');
- OC.PasswordConfirmation.requirePasswordConfirmation(self.callback, config);
- }
- });
- }
-};
-
$(document).ready(initCore);
/**