diff options
author | guillaume <guillaume.cassou@supinfo.com> | 2018-12-19 17:21:27 +0100 |
---|---|---|
committer | guillaume <guillaume.cassou@supinfo.com> | 2018-12-19 17:21:27 +0100 |
commit | 1712368f6a1ec07bad2c1edb17ae480397e0f45f (patch) | |
tree | 188df0764164bc3aa877a86b19e75717f513df24 /client | |
parent | d7529bf6b515375cbb089473c1e2cdca1ec61a3c (diff) | |
download | wekan-1712368f6a1ec07bad2c1edb17ae480397e0f45f.tar.gz wekan-1712368f6a1ec07bad2c1edb17ae480397e0f45f.tar.bz2 wekan-1712368f6a1ec07bad2c1edb17ae480397e0f45f.zip |
Improves UI for ldap error messages
Diffstat (limited to 'client')
-rw-r--r-- | client/components/main/layouts.js | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/client/components/main/layouts.js b/client/components/main/layouts.js index 7c060ca5..abc8f6e1 100644 --- a/client/components/main/layouts.js +++ b/client/components/main/layouts.js @@ -121,20 +121,35 @@ function authentication(instance, email, password) { return this.stop(); } - const authenticationMethod = user ? - user.authenticationMethod : - instance.data.defaultAuthenticationMethod.get(); - - // Authentication with LDAP - if (authenticationMethod === 'ldap') { - // Use the ldap connection package - Meteor.loginWithLDAP(email, password, function(error) { - if (!error) { - return FlowRouter.go('/'); - } - return error; - }); + const authenticationMethod = user + ? user.authenticationMethod + : instance.data.defaultAuthenticationMethod.get(); + + switch (authenticationMethod) { + case 'ldap': + // Use the ldap connection package + Meteor.loginWithLDAP(email, password, function(error) { + if (!error) return FlowRouter.go('/'); + displayError('error-ldap-login'); + }); + break; + + default: + displayError('error-undefined'); } return this.stop(); } + +function displayError(code) { + const translated = TAPi18n.__(code); + + if (translated === code) { + return; + } + + if(!$('.at-error').length) { + $('.at-pwd-form').before('<div class="at-error"><p></p></div>'); + } + $('.at-error p').text(translated); +}
\ No newline at end of file |