Not disabled by default
Fixed transition bug of grouptop Fix password submit and error handling Fixed multiple form send Fix submit loading state fix login form sending state Replace loader type Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
parent
6347fe86c9
commit
91195b7cf2
|
@ -12,12 +12,17 @@
|
||||||
*/
|
*/
|
||||||
OC.Login = _.extend(OC.Login || {}, {
|
OC.Login = _.extend(OC.Login || {}, {
|
||||||
onLogin: function () {
|
onLogin: function () {
|
||||||
$('#submit-wrapper .submit-icon')
|
// Only if password reset form is not active
|
||||||
.removeClass('icon-confirm-white')
|
if($('form[name=login][action]').length === 0) {
|
||||||
.addClass('icon-loading-small');
|
$('#submit-wrapper .submit-icon')
|
||||||
$('#submit')
|
.removeClass('icon-confirm-white')
|
||||||
.attr('value', t('core', 'Logging in …'));
|
.addClass('icon-loading-small-dark');
|
||||||
return true;
|
$('#submit')
|
||||||
|
.attr('value', t('core', 'Logging in …'));
|
||||||
|
$('.login-additional').fadeOut();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
rememberLogin: function(){
|
rememberLogin: function(){
|
||||||
|
|
|
@ -14,16 +14,23 @@ OC.Lostpassword = {
|
||||||
|
|
||||||
init : function() {
|
init : function() {
|
||||||
$('#lost-password').click(OC.Lostpassword.resetLink);
|
$('#lost-password').click(OC.Lostpassword.resetLink);
|
||||||
$('#reset-password-submit').click(OC.Lostpassword.resetPassword);
|
|
||||||
$('#lost-password-back').click(OC.Lostpassword.backToLogin);
|
$('#lost-password-back').click(OC.Lostpassword.backToLogin);
|
||||||
$('#reset-password-wrapper .submit-icon')
|
$('form[name=login]').submit(OC.Lostpassword.onSendLink);
|
||||||
.addClass('icon-confirm-white')
|
OC.Lostpassword.resetButtons();
|
||||||
.removeClass('icon-loading-small');
|
|
||||||
$('#reset-password-submit')
|
|
||||||
.attr('value', t('core', 'Reset password'));
|
|
||||||
},
|
},
|
||||||
|
|
||||||
backToLogin : function(event){
|
resetButtons : function() {
|
||||||
|
$('#reset-password-wrapper .submit-icon')
|
||||||
|
.addClass('icon-confirm-white')
|
||||||
|
.removeClass('icon-loading-small-dark');
|
||||||
|
$('#reset-password-submit')
|
||||||
|
.attr('value', t('core', 'Reset password'))
|
||||||
|
.prop('disabled', false);
|
||||||
|
$('#user').prop('disabled', false);
|
||||||
|
$('.login-additional').fadeIn();
|
||||||
|
},
|
||||||
|
|
||||||
|
backToLogin : function(event) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
$('#reset-password-wrapper').slideUp().fadeOut();
|
$('#reset-password-wrapper').slideUp().fadeOut();
|
||||||
|
@ -32,6 +39,8 @@ OC.Lostpassword = {
|
||||||
$('#submit-wrapper').slideDown().fadeIn();
|
$('#submit-wrapper').slideDown().fadeIn();
|
||||||
$('.groupbottom').slideDown().fadeIn();
|
$('.groupbottom').slideDown().fadeIn();
|
||||||
$('#user').parent().addClass('grouptop');
|
$('#user').parent().addClass('grouptop');
|
||||||
|
$('#password').attr('required', true);
|
||||||
|
$('form[name=login]').removeAttr('action');
|
||||||
$('#user').focus();
|
$('#user').focus();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -41,12 +50,15 @@ OC.Lostpassword = {
|
||||||
$('#lost-password').slideUp().fadeOut();
|
$('#lost-password').slideUp().fadeOut();
|
||||||
$('.remember-login-container').slideUp().fadeOut();
|
$('.remember-login-container').slideUp().fadeOut();
|
||||||
$('#submit-wrapper').slideUp().fadeOut();
|
$('#submit-wrapper').slideUp().fadeOut();
|
||||||
$('.groupbottom').slideUp().fadeOut();
|
$('.groupbottom').slideUp().fadeOut(function(){
|
||||||
$('#user').parent().removeClass('grouptop');
|
$('#user').parent().removeClass('grouptop');
|
||||||
|
});
|
||||||
$('#reset-password-wrapper').slideDown().fadeIn();
|
$('#reset-password-wrapper').slideDown().fadeIn();
|
||||||
|
$('#password').attr('required', false);
|
||||||
|
$('form[name=login]').attr('action', 'lostpassword/email');
|
||||||
$('#user').focus();
|
$('#user').focus();
|
||||||
|
|
||||||
// Generate a browser warning if field empty
|
// Generate a browser warning for required fields if field empty
|
||||||
if ($('#user').val().length === 0) {
|
if ($('#user').val().length === 0) {
|
||||||
$('#submit').trigger('click');
|
$('#submit').trigger('click');
|
||||||
} else {
|
} else {
|
||||||
|
@ -56,26 +68,34 @@ OC.Lostpassword = {
|
||||||
window.location = OC.config.lost_password_link;
|
window.location = OC.config.lost_password_link;
|
||||||
} else {
|
} else {
|
||||||
OC.Lostpassword.onSendLink();
|
OC.Lostpassword.onSendLink();
|
||||||
$.post(
|
|
||||||
OC.generateUrl('/lostpassword/email'),
|
|
||||||
{
|
|
||||||
user : $('#user').val()
|
|
||||||
},
|
|
||||||
OC.Lostpassword.sendLinkDone
|
|
||||||
).fail(function() {
|
|
||||||
OC.Lostpassword.sendLinkError(OC.Lostpassword.sendErrorMsg);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onSendLink: function () {
|
onSendLink: function (event) {
|
||||||
$('.submit-icon')
|
// Only if password reset form is active
|
||||||
.removeClass('icon-confirm-white')
|
if($('form[name=login][action]').length === 1) {
|
||||||
.addClass('icon-loading-small');
|
if (event) {
|
||||||
$('#reset-password-submit')
|
event.preventDefault();
|
||||||
.attr('value', t('core', 'Sending email …'));
|
}
|
||||||
return true;
|
$('#reset-password-wrapper .submit-icon')
|
||||||
|
.removeClass('icon-confirm-white')
|
||||||
|
.addClass('icon-loading-small-dark');
|
||||||
|
$('#reset-password-submit')
|
||||||
|
.attr('value', t('core', 'Sending email …'))
|
||||||
|
.prop('disabled', true);
|
||||||
|
$('#user').prop('disabled', true);
|
||||||
|
$('.login-additional').fadeOut();
|
||||||
|
$.post(
|
||||||
|
OC.generateUrl('/lostpassword/email'),
|
||||||
|
{
|
||||||
|
user : $('#user').val()
|
||||||
|
},
|
||||||
|
OC.Lostpassword.sendLinkDone
|
||||||
|
).fail(function() {
|
||||||
|
OC.Lostpassword.sendLinkError(OC.Lostpassword.sendErrorMsg);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
sendLinkDone : function(result){
|
sendLinkDone : function(result){
|
||||||
|
@ -104,7 +124,7 @@ OC.Lostpassword = {
|
||||||
var node = OC.Lostpassword.getSendStatusNode();
|
var node = OC.Lostpassword.getSendStatusNode();
|
||||||
node.addClass('warning');
|
node.addClass('warning');
|
||||||
node.html(msg);
|
node.html(msg);
|
||||||
OC.Lostpassword.init();
|
OC.Lostpassword.resetButtons();
|
||||||
},
|
},
|
||||||
|
|
||||||
getSendStatusNode : function(){
|
getSendStatusNode : function(){
|
||||||
|
|
Loading…
Reference in New Issue