From ae60d827c69dfd491e333caf494887adcf32d21f Mon Sep 17 00:00:00 2001 From: Carl Chenet Date: Wed, 17 May 2017 18:34:19 +0200 Subject: [PATCH] i18n of 2FA login --- app/controllers/login_controller.rb | 2 +- app/views/login/twofa.html.erb | 8 ++++---- config/locales/en.yml | 7 +++++++ config/locales/fr.yml | 7 +++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index 1e2a9d4..ec4f6f9 100644 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -148,7 +148,7 @@ class LoginController < ApplicationController session.delete(:twofa_u) return redirect_to "/" else - flash[:error] = "Your TOTP code did not match. Please try again." + flash[:error] = t('.totpcodenotmatch') return redirect_to "/login/2fa" end end diff --git a/app/views/login/twofa.html.erb b/app/views/login/twofa.html.erb index c069579..07cc840 100644 --- a/app/views/login/twofa.html.erb +++ b/app/views/login/twofa.html.erb @@ -1,22 +1,22 @@
- Login - Two Factor Authentication + <%= t('.login2fa') %>
<%= form_tag twofa_login_url do %>

- Enter the current TOTP code from your TOTP application: + <%= t('.logintotpcode') %>

- <%= label_tag :totp_code, "TOTP Code:" %> + <%= label_tag :totp_code, t('.totpcode') %> <%= text_field_tag :totp_code, "", :size => 10, :type => "number", :autofocus => "autofocus" %>

- <%= submit_tag "Login" %> + <%= submit_tag t('.loginbutton') %>

<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml index 91c0e32..afeb79d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -174,6 +174,13 @@ en: password: "New Password:" again: "(Again):" setpassbutton: "Set New Password" + twofa: + login2fa: "Login - Two Factor Authentication" + logintotpcode: "Enter the current TOTP code from your TOTP application:" + loginbutton: "Login" + totpcode: "TOTP Code:" + twofa_verify: + totpcodenotmatch: "Your TOTP code did not match. Please try again." messages: index: viewreceived: "View Received" diff --git a/config/locales/fr.yml b/config/locales/fr.yml index f755aac..2866e08 100644 --- a/config/locales/fr.yml +++ b/config/locales/fr.yml @@ -174,6 +174,13 @@ fr: password: "Mot de passe :" again: "(encore):" setpassbutton: "Changer le mot de passe" + twofa: + login2fa: "Identification par authentification à deux facteurs" + logintotpcode: "Entrez le code TOTP affiché par votre application :" + loginbutton: "S'identifier" + totpcode: "Code TOTP :" + twofa_verify: + totpcodenotmatch: "Code TOTP incorrect. Merci de ré-essayer." filters: index: filteredtags: "Marques filtrées"