Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/OC/password-confirmation.js')
-rw-r--r--core/src/OC/password-confirmation.js24
1 files changed, 14 insertions, 10 deletions
diff --git a/core/src/OC/password-confirmation.js b/core/src/OC/password-confirmation.js
index f708217fc84..ec70720b4d2 100644
--- a/core/src/OC/password-confirmation.js
+++ b/core/src/OC/password-confirmation.js
@@ -1,7 +1,9 @@
/**
* @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
*
- * @author 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
*
* @license GNU AGPL version 3 or any later version
*
@@ -16,12 +18,14 @@
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
*/
import _ from 'underscore'
import $ from 'jquery'
import moment from 'moment'
+import { generateUrl } from '@nextcloud/router'
import OC from './index'
@@ -33,12 +37,12 @@ export default {
pageLoadTime: null,
- init: function() {
+ init() {
$('.password-confirm-required').on('click', _.bind(this.requirePasswordConfirmation, this))
this.pageLoadTime = moment.now()
},
- requiresPasswordConfirmation: function() {
+ requiresPasswordConfirmation() {
const serverTimeDiff = this.pageLoadTime - (window.nc_pageLoad * 1000)
const timeSinceLogin = moment.now() - (serverTimeDiff + (window.nc_lastLogin * 1000))
@@ -51,7 +55,7 @@ export default {
* @param {Object} options options
* @param {Function} rejectCallback error callback function
*/
- requirePasswordConfirmation: function(callback, options, rejectCallback) {
+ requirePasswordConfirmation(callback, options, rejectCallback) {
options = typeof options !== 'undefined' ? options : {}
const defaults = {
title: t('core', 'Authentication required'),
@@ -101,23 +105,23 @@ export default {
this.callback = callback
},
- _confirmPassword: function(password, config) {
+ _confirmPassword(password, config) {
const self = this
$.ajax({
- url: OC.generateUrl('/login/confirm'),
+ url: generateUrl('/login/confirm'),
data: {
- password: password,
+ password,
},
type: 'POST',
- success: function(response) {
+ success(response) {
window.nc_lastLogin = response.lastLogin
if (_.isFunction(self.callback)) {
self.callback()
}
},
- error: function() {
+ error() {
config.error = t('core', 'Failed to authenticate, try again')
OC.PasswordConfirmation.requirePasswordConfirmation(self.callback, config)
},