Improves UI for ldap error messages

reviewable/pr2065/r1
guillaume 7 years ago
parent d7529bf6b5
commit 1712368f6a
  1. 33
      client/components/main/layouts.js
  2. 4
      i18n/en.i18n.json
  3. 4
      i18n/fr.i18n.json

@ -121,20 +121,35 @@ function authentication(instance, email, password) {
return this.stop(); return this.stop();
} }
const authenticationMethod = user ? const authenticationMethod = user
user.authenticationMethod : ? user.authenticationMethod
instance.data.defaultAuthenticationMethod.get(); : instance.data.defaultAuthenticationMethod.get();
// Authentication with LDAP switch (authenticationMethod) {
if (authenticationMethod === 'ldap') { case 'ldap':
// Use the ldap connection package // Use the ldap connection package
Meteor.loginWithLDAP(email, password, function(error) { Meteor.loginWithLDAP(email, password, function(error) {
if (!error) { if (!error) return FlowRouter.go('/');
return FlowRouter.go('/'); displayError('error-ldap-login');
}
return error;
}); });
break;
default:
displayError('error-undefined');
} }
return this.stop(); 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);
}

@ -620,5 +620,7 @@
"layout": "Layout", "layout": "Layout",
"hide-logo": "Hide Logo", "hide-logo": "Hide Logo",
"add-custom-html-after-body-start": "Add Custom HTML after <body> start", "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"
} }

@ -619,5 +619,7 @@
"layout": "Interface", "layout": "Interface",
"hide-logo": "Cacher le logo", "hide-logo": "Cacher le logo",
"add-custom-html-after-body-start": "Add Custom HTML after <body> start", "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"
} }
Loading…
Cancel
Save