aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-11-05 16:33:18 +0100
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2017-11-05 17:38:29 +0100
commit91195b7cf2e55d82b98fdc76ef4ad4a6eecad10d (patch)
tree9576f92df00b944818a9147833eb45a0a955dd38 /core
parent6347fe86c9fbecc49c25b732da9e3ba858356b48 (diff)
downloadnextcloud-server-91195b7cf2e55d82b98fdc76ef4ad4a6eecad10d.tar.gz
nextcloud-server-91195b7cf2e55d82b98fdc76ef4ad4a6eecad10d.zip
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>
Diffstat (limited to 'core')
-rw-r--r--core/js/login.js17
-rw-r--r--core/js/lostpassword.js68
2 files changed, 55 insertions, 30 deletions
diff --git a/core/js/login.js b/core/js/login.js
index 09e7499e811..012b4e0280e 100644
--- a/core/js/login.js
+++ b/core/js/login.js
@@ -12,12 +12,17 @@
*/
OC.Login = _.extend(OC.Login || {}, {
onLogin: function () {
- $('#submit-wrapper .submit-icon')
- .removeClass('icon-confirm-white')
- .addClass('icon-loading-small');
- $('#submit')
- .attr('value', t('core', 'Logging in …'));
- return true;
+ // Only if password reset form is not active
+ if($('form[name=login][action]').length === 0) {
+ $('#submit-wrapper .submit-icon')
+ .removeClass('icon-confirm-white')
+ .addClass('icon-loading-small-dark');
+ $('#submit')
+ .attr('value', t('core', 'Logging in …'));
+ $('.login-additional').fadeOut();
+ return true;
+ }
+ return false;
},
rememberLogin: function(){
diff --git a/core/js/lostpassword.js b/core/js/lostpassword.js
index 6c34e7b40fc..bd7dc9de399 100644
--- a/core/js/lostpassword.js
+++ b/core/js/lostpassword.js
@@ -14,16 +14,23 @@ OC.Lostpassword = {
init : function() {
$('#lost-password').click(OC.Lostpassword.resetLink);
- $('#reset-password-submit').click(OC.Lostpassword.resetPassword);
$('#lost-password-back').click(OC.Lostpassword.backToLogin);
+ $('form[name=login]').submit(OC.Lostpassword.onSendLink);
+ OC.Lostpassword.resetButtons();
+ },
+
+ resetButtons : function() {
$('#reset-password-wrapper .submit-icon')
.addClass('icon-confirm-white')
- .removeClass('icon-loading-small');
+ .removeClass('icon-loading-small-dark');
$('#reset-password-submit')
- .attr('value', t('core', 'Reset password'));
+ .attr('value', t('core', 'Reset password'))
+ .prop('disabled', false);
+ $('#user').prop('disabled', false);
+ $('.login-additional').fadeIn();
},
- backToLogin : function(event){
+ backToLogin : function(event) {
event.preventDefault();
$('#reset-password-wrapper').slideUp().fadeOut();
@@ -32,6 +39,8 @@ OC.Lostpassword = {
$('#submit-wrapper').slideDown().fadeIn();
$('.groupbottom').slideDown().fadeIn();
$('#user').parent().addClass('grouptop');
+ $('#password').attr('required', true);
+ $('form[name=login]').removeAttr('action');
$('#user').focus();
},
@@ -41,12 +50,15 @@ OC.Lostpassword = {
$('#lost-password').slideUp().fadeOut();
$('.remember-login-container').slideUp().fadeOut();
$('#submit-wrapper').slideUp().fadeOut();
- $('.groupbottom').slideUp().fadeOut();
- $('#user').parent().removeClass('grouptop');
+ $('.groupbottom').slideUp().fadeOut(function(){
+ $('#user').parent().removeClass('grouptop');
+ });
$('#reset-password-wrapper').slideDown().fadeIn();
+ $('#password').attr('required', false);
+ $('form[name=login]').attr('action', 'lostpassword/email');
$('#user').focus();
- // Generate a browser warning if field empty
+ // Generate a browser warning for required fields if field empty
if ($('#user').val().length === 0) {
$('#submit').trigger('click');
} else {
@@ -56,26 +68,34 @@ OC.Lostpassword = {
window.location = OC.config.lost_password_link;
} else {
OC.Lostpassword.onSendLink();
- $.post(
- OC.generateUrl('/lostpassword/email'),
- {
- user : $('#user').val()
- },
- OC.Lostpassword.sendLinkDone
- ).fail(function() {
- OC.Lostpassword.sendLinkError(OC.Lostpassword.sendErrorMsg);
- });
}
}
},
- onSendLink: function () {
- $('.submit-icon')
- .removeClass('icon-confirm-white')
- .addClass('icon-loading-small');
- $('#reset-password-submit')
- .attr('value', t('core', 'Sending email …'));
- return true;
+ onSendLink: function (event) {
+ // Only if password reset form is active
+ if($('form[name=login][action]').length === 1) {
+ if (event) {
+ event.preventDefault();
+ }
+ $('#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){
@@ -104,7 +124,7 @@ OC.Lostpassword = {
var node = OC.Lostpassword.getSendStatusNode();
node.addClass('warning');
node.html(msg);
- OC.Lostpassword.init();
+ OC.Lostpassword.resetButtons();
},
getSendStatusNode : function(){