summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--client/components/main/layouts.js41
-rw-r--r--i18n/en.i18n.json4
-rw-r--r--i18n/fr.i18n.json4
3 files changed, 34 insertions, 15 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
diff --git a/i18n/en.i18n.json b/i18n/en.i18n.json
index 5aa04e97..a4138f14 100644
--- a/i18n/en.i18n.json
+++ b/i18n/en.i18n.json
@@ -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"
}
diff --git a/i18n/fr.i18n.json b/i18n/fr.i18n.json
index 98fade89..f2a7c5db 100644
--- a/i18n/fr.i18n.json
+++ b/i18n/fr.i18n.json
@@ -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"
} \ No newline at end of file