Improves UI for ldap error messages

This commit is contained in:
guillaume 2018-12-19 17:21:27 +01:00
parent d7529bf6b5
commit 1712368f6a
3 changed files with 33 additions and 14 deletions

View file

@ -121,20 +121,35 @@ function authentication(instance, email, password) {
return this.stop();
}
const authenticationMethod = user ?
user.authenticationMethod :
instance.data.defaultAuthenticationMethod.get();
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;
});
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);
}

View file

@ -620,5 +620,7 @@
"layout": "Layout",
"hide-logo": "Hide Logo",
"add-custom-html-after-body-start": "Add Custom HTML after <body> start",
"add-custom-html-before-body-end": "Add Custom HTML before </body> end"
"add-custom-html-before-body-end": "Add Custom HTML before </body> end",
"error-undefined": "Something went wrong",
"error-ldap-login": "An error occurred while trying to login"
}

View file

@ -619,5 +619,7 @@
"layout": "Interface",
"hide-logo": "Cacher le logo",
"add-custom-html-after-body-start": "Add Custom HTML after <body> start",
"add-custom-html-before-body-end": "Add Custom HTML before </body> end"
"add-custom-html-before-body-end": "Add Custom HTML before </body> end",
"error-undefined": "Une erreur inconnue s'est produite",
"error-ldap-login": "Une erreur s'est produite lors de la tentative de connexion"
}