diff options
author | Lauri Ojansivu <x@xet7.org> | 2019-04-24 14:41:37 +0300 |
---|---|---|
committer | Lauri Ojansivu <x@xet7.org> | 2019-04-24 14:41:37 +0300 |
commit | 4282906833f3427e3793be7973e4722bd45d7aeb (patch) | |
tree | ffecc435186abd785fd6ae8b9c4540aa81867e05 /client/components/main/layouts.js | |
parent | b1cfd8229a9aad0492e5f4d4ae0b2b412d8ebe22 (diff) | |
parent | aeb3dd0220841f4248d832d0308e059a261d815d (diff) | |
download | wekan-4282906833f3427e3793be7973e4722bd45d7aeb.tar.gz wekan-4282906833f3427e3793be7973e4722bd45d7aeb.tar.bz2 wekan-4282906833f3427e3793be7973e4722bd45d7aeb.zip |
Merge branch 'edge' into meteor-1.8
Diffstat (limited to 'client/components/main/layouts.js')
-rw-r--r-- | client/components/main/layouts.js | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/client/components/main/layouts.js b/client/components/main/layouts.js index 6f7c914a..d5113a25 100644 --- a/client/components/main/layouts.js +++ b/client/components/main/layouts.js @@ -23,6 +23,7 @@ const validator = { Template.userFormsLayout.onCreated(function() { const instance = this; instance.currentSetting = new ReactiveVar(); + instance.isLoading = new ReactiveVar(false); Meteor.subscribe('setting', { onReady() { @@ -47,6 +48,10 @@ Template.userFormsLayout.helpers({ return Template.instance().currentSetting.get(); }, + isLoading() { + return Template.instance().isLoading.get(); + }, + afterBodyStart() { return currentSetting.customHTMLafterBodyStart; }, @@ -89,7 +94,11 @@ Template.userFormsLayout.events({ }, 'click #at-btn'(event, instance) { if (FlowRouter.getRouteName() === 'atSignIn') { - authentication(event, instance); + instance.isLoading.set(true); + authentication(event, instance) + .then(() => { + instance.isLoading.set(false); + }); } }, }); @@ -104,11 +113,11 @@ async function authentication(event, instance) { const match = $('#at-field-username_and_email').val(); const password = $('#at-field-password').val(); - if (!match || !password) return; + if (!match || !password) return undefined; const result = await getAuthenticationMethod(instance.currentSetting.get(), match); - if (result === 'password') return; + if (result === 'password') return undefined; // Stop submit #at-pwd-form event.preventDefault(); @@ -116,19 +125,21 @@ async function authentication(event, instance) { switch (result) { case 'ldap': - Meteor.loginWithLDAP(match, password, function() { - FlowRouter.go('/'); + return new Promise((resolve) => { + Meteor.loginWithLDAP(match, password, function() { + resolve(FlowRouter.go('/')); + }); }); - break; case 'cas': - Meteor.loginWithCas(function() { - FlowRouter.go('/'); + return new Promise((resolve) => { + Meteor.loginWithCas(match, password, function() { + resolve(FlowRouter.go('/')); + }); }); - break; default: - break; + return undefined; } } |