i18n of 2FA login

This commit is contained in:
Carl Chenet 2017-05-17 18:34:19 +02:00
parent 787a82c88b
commit ae60d827c6
4 changed files with 19 additions and 5 deletions

View file

@ -148,7 +148,7 @@ class LoginController < ApplicationController
session.delete(:twofa_u) session.delete(:twofa_u)
return redirect_to "/" return redirect_to "/"
else else
flash[:error] = "Your TOTP code did not match. Please try again." flash[:error] = t('.totpcodenotmatch')
return redirect_to "/login/2fa" return redirect_to "/login/2fa"
end end
end end

View file

@ -1,22 +1,22 @@
<div class="box wide"> <div class="box wide">
<div class="legend"> <div class="legend">
Login - Two Factor Authentication <%= t('.login2fa') %>
</div> </div>
<%= form_tag twofa_login_url do %> <%= form_tag twofa_login_url do %>
<p> <p>
Enter the current TOTP code from your TOTP application: <%= t('.logintotpcode') %>
</p> </p>
<p> <p>
<%= label_tag :totp_code, "TOTP Code:" %> <%= label_tag :totp_code, t('.totpcode') %>
<%= text_field_tag :totp_code, "", :size => 10, :type => "number", <%= text_field_tag :totp_code, "", :size => 10, :type => "number",
:autofocus => "autofocus" %> :autofocus => "autofocus" %>
<br /> <br />
</p> </p>
<p> <p>
<%= submit_tag "Login" %> <%= submit_tag t('.loginbutton') %>
</p> </p>
<% end %> <% end %>
</div> </div>

View file

@ -174,6 +174,13 @@ en:
password: "New Password:" password: "New Password:"
again: "(Again):" again: "(Again):"
setpassbutton: "Set New Password" 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: messages:
index: index:
viewreceived: "View Received" viewreceived: "View Received"

View file

@ -174,6 +174,13 @@ fr:
password: "Mot de passe :" password: "Mot de passe :"
again: "(encore):" again: "(encore):"
setpassbutton: "Changer le mot de passe" 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: filters:
index: index:
filteredtags: "Marques filtrées" filteredtags: "Marques filtrées"