2015-08-27 22:02:00 +03:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015
|
|
|
|
* Vincent Petry <pvince81@owncloud.com>
|
|
|
|
* Jan-Christoph Borchardt, http://jancborchardt.net
|
|
|
|
* This file is licensed under the Affero General Public License version 3 or later.
|
|
|
|
* See the COPYING-README file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @namespace
|
|
|
|
* @memberOf OC
|
2018-10-24 17:24:16 +03:00
|
|
|
* @private
|
2015-08-27 22:02:00 +03:00
|
|
|
*/
|
|
|
|
OC.Login = _.extend(OC.Login || {}, {
|
|
|
|
onLogin: function () {
|
2017-11-05 18:33:18 +03:00
|
|
|
// Only if password reset form is not active
|
|
|
|
if($('form[name=login][action]').length === 0) {
|
|
|
|
$('#submit-wrapper .submit-icon')
|
|
|
|
.removeClass('icon-confirm-white')
|
2018-11-16 14:48:11 +03:00
|
|
|
.addClass(OCA.Theming && OCA.Theming.inverted
|
|
|
|
? 'icon-loading-small'
|
|
|
|
: 'icon-loading-small-dark');
|
2017-11-05 18:33:18 +03:00
|
|
|
$('#submit')
|
|
|
|
.attr('value', t('core', 'Logging in …'));
|
|
|
|
$('.login-additional').fadeOut();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2016-03-03 21:52:04 +03:00
|
|
|
},
|
|
|
|
|
|
|
|
rememberLogin: function(){
|
|
|
|
if($(this).is(":checked")){
|
2016-10-06 17:48:10 +03:00
|
|
|
if($("#user").val() && $("#password").val()) {
|
|
|
|
$('#submit').trigger('click');
|
|
|
|
}
|
|
|
|
}
|
2015-08-27 22:02:00 +03:00
|
|
|
}
|
|
|
|
});
|
2016-03-03 21:52:04 +03:00
|
|
|
|
2015-08-27 22:02:00 +03:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('form[name=login]').submit(OC.Login.onLogin);
|
2016-03-03 21:52:04 +03:00
|
|
|
|
|
|
|
$('#remember_login').click(OC.Login.rememberLogin);
|
2018-08-27 13:18:14 +03:00
|
|
|
|
|
|
|
var clearParamRegex = new RegExp('clear=1');
|
|
|
|
if (clearParamRegex.test(window.location.href)) {
|
|
|
|
window.localStorage.clear();
|
|
|
|
window.sessionStorage.clear();
|
|
|
|
}
|
2015-08-27 22:02:00 +03:00
|
|
|
});
|