diff --git a/Controller/SecuredController.php b/Controller/SecuredController.php
index f0c928d..2264eaa 100755
--- a/Controller/SecuredController.php
+++ b/Controller/SecuredController.php
@@ -25,6 +25,7 @@ public function loginAction(Request $request)
$error = $request->getSession()->get(SecurityContext::AUTHENTICATION_ERROR);
}
+ $error = $this->extractAuthErrorI18N($error);
return $this->render('ChateaSecureBundle:Secured:login.html.twig',array(
'last_username' => $request->getSession()->get(SecurityContext::LAST_USERNAME),
@@ -47,4 +48,19 @@ public function logoutAction()
{
// The security layer will intercept this request
}
+
+ private function extractAuthErrorI18N($error)
+ {
+ $translator = $this->get('translator');
+ $translationMap = array(
+ 'Bad credentials' => 'login.bad_credentials'
+ );
+ $message = $error->getMessage();
+
+ if(isset($translationMap[$message])){
+ return $translator->trans($translationMap[$message], array(), 'Login');
+ }
+
+ return $message;
+ }
}
\ No newline at end of file
diff --git a/Resources/config/services.xml b/Resources/config/services.xml
index 6f4e511..c18b62a 100755
--- a/Resources/config/services.xml
+++ b/Resources/config/services.xml
@@ -27,6 +27,7 @@
+
diff --git a/Resources/translations/Login.en.yml b/Resources/translations/Login.en.yml
index 590f4b8..c7e3a44 100644
--- a/Resources/translations/Login.en.yml
+++ b/Resources/translations/Login.en.yml
@@ -1,4 +1,13 @@
login.login: "Login"
login.username: "Username"
login.password: "Password"
-login.submit: "Login"
\ No newline at end of file
+login.submit: "Login"
+login.bad_credentials: "Bad credentials"
+login.service_down: 'Authentication service down'
+login.incorrect_credentialas: 'Incorrect username or password for %username%'
+login.class_not_supported: 'Instances of "%class%" are not supported.'
+login.method_not_supported: 'This method is not soported'
+login.incorrect_facebookid: 'Incorrect facebookId'
+login.facebookid_not_empty: 'The facebookId cannot be empty.'
+login.password_not_empty: 'The password cannot be empty.'
+login.username_not_empty: 'The username cannot be empty.'
\ No newline at end of file
diff --git a/Resources/translations/Login.es.yml b/Resources/translations/Login.es.yml
index 01ace25..eb95790 100644
--- a/Resources/translations/Login.es.yml
+++ b/Resources/translations/Login.es.yml
@@ -1,4 +1,6 @@
login.login: "Autenticar"
login.username: "Nombre de usuario"
login.password: "Contraseña"
-login.submit: "Autenticar"
\ No newline at end of file
+login.submit: "Autenticar"
+login.bad_credentials: "Usuario o contraseña incorrecto"
+login.service_down: 'Servicio de autenticación no disponible'
\ No newline at end of file
diff --git a/Resources/views/Secured/login.html.twig b/Resources/views/Secured/login.html.twig
index 434cc4b..4319d55 100755
--- a/Resources/views/Secured/login.html.twig
+++ b/Resources/views/Secured/login.html.twig
@@ -6,7 +6,7 @@
{{ "login.login" | trans }}
{% if error %}
- {{ error.message }}
+ {{ error }}
{% endif %}