i18n of 2FA process
This commit is contained in:
parent
71acdd69cc
commit
787a82c88b
|
@ -76,7 +76,7 @@ class SettingsController < ApplicationController
|
|||
end
|
||||
|
||||
def twofa
|
||||
@title = "Two-Factor Authentication"
|
||||
@title = t('.title')
|
||||
end
|
||||
|
||||
def twofa_auth
|
||||
|
@ -86,22 +86,22 @@ class SettingsController < ApplicationController
|
|||
|
||||
if @user.has_2fa?
|
||||
@user.disable_2fa!
|
||||
flash[:success] = "Two-Factor Authentication has been disabled."
|
||||
flash[:success] = t('.2fahasbeendisabled')
|
||||
return redirect_to "/settings"
|
||||
else
|
||||
return redirect_to twofa_enroll_url
|
||||
end
|
||||
else
|
||||
flash[:error] = "Your password was not correct."
|
||||
flash[:error] = t('.2fapassnotcorrect')
|
||||
return redirect_to twofa_url
|
||||
end
|
||||
end
|
||||
|
||||
def twofa_enroll
|
||||
@title = "Two-Factor Authentication"
|
||||
@title = t('.title')
|
||||
|
||||
if (Time.now.to_i - session[:last_authed].to_i) > TOTP_SESSION_TIMEOUT
|
||||
flash[:error] = "Your enrollment period timed out."
|
||||
flash[:error] = t('.enrollmenttimeout')
|
||||
return redirect_to twofa_url
|
||||
end
|
||||
|
||||
|
@ -122,11 +122,11 @@ class SettingsController < ApplicationController
|
|||
end
|
||||
|
||||
def twofa_verify
|
||||
@title = "Two-Factor Authentication"
|
||||
@title = t('.title')
|
||||
|
||||
if ((Time.now.to_i - session[:last_authed].to_i) > TOTP_SESSION_TIMEOUT) ||
|
||||
!session[:totp_secret]
|
||||
flash[:error] = "Your enrollment period timed out."
|
||||
flash[:error] = t('.enrollmenttimeout')
|
||||
return redirect_to twofa_url
|
||||
end
|
||||
end
|
||||
|
@ -134,7 +134,7 @@ class SettingsController < ApplicationController
|
|||
def twofa_update
|
||||
if ((Time.now.to_i - session[:last_authed].to_i) > TOTP_SESSION_TIMEOUT) ||
|
||||
!session[:totp_secret]
|
||||
flash[:error] = "Your enrollment period timed out."
|
||||
flash[:error] = t('.enrollmenttimeout')
|
||||
return redirect_to twofa_url
|
||||
end
|
||||
|
||||
|
@ -146,13 +146,11 @@ class SettingsController < ApplicationController
|
|||
|
||||
session[:u] = @user.session_token
|
||||
|
||||
flash[:success] = "Two-Factor Authentication has been enabled on " <<
|
||||
"your account."
|
||||
flash[:success] = t('.2fahasbeenenabled')
|
||||
session.delete(:totp_secret)
|
||||
return redirect_to "/settings"
|
||||
else
|
||||
flash[:error] = "Your TOTP code was invalid, please verify the " <<
|
||||
"current code in your TOTP application."
|
||||
flash[:error] = t('.totpinvalid')
|
||||
return redirect_to twofa_verify_url
|
||||
end
|
||||
end
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
<span>
|
||||
<% if @edit_user.totp_secret.present? %>
|
||||
<span style="color: green; font-weight: bold;">
|
||||
<%= t('.enrolled2fa') %>
|
||||
<%= t('.enabled2fa') %>
|
||||
</span> (<a href="/settings/2fa"><%= t('.disable2fa') %></a>)
|
||||
<% else %>
|
||||
<%= t('.disabled2fa') %> (<a href="/settings/2fa"><%= t('.enroll2fa') %></a>)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<div class="box wide">
|
||||
<div class="legend right">
|
||||
<a href="/settings">Back to Settings</a>
|
||||
<a href="/settings"><%= t('.backtosettings') %></a>
|
||||
</div>
|
||||
<div class="legend">
|
||||
<%= @title %>
|
||||
|
@ -9,24 +9,22 @@
|
|||
<%= form_for @user, :url => twofa_auth_url, :method => :post do |f| %>
|
||||
<p>
|
||||
<% if @user.has_2fa? %>
|
||||
To turn off two-factor authentication for your account, enter your
|
||||
current password:
|
||||
<%= t('.turnoff') %>
|
||||
<% else %>
|
||||
To begin the two-factor authentication enrollment for your account,
|
||||
enter your current password:
|
||||
<%= t('.turnon') %>
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<div class="boxline">
|
||||
<%= f.label :password, "Current Password:", :class => "required" %>
|
||||
<%= f.label :password, t('.currentpassword'), :class => "required" %>
|
||||
<%= f.password_field :password, :size => 40, :autocomplete => "off" %>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<% if @user.has_2fa? %>
|
||||
<%= submit_tag "Disable Two-Factor Authentication" %>
|
||||
<%= submit_tag t('.disable2fa') %>
|
||||
<% else %>
|
||||
<%= submit_tag "Continue" %>
|
||||
<%= submit_tag t('.continue') %>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
<div class="box wide">
|
||||
<div class="legend right">
|
||||
<a href="/settings">Back to Settings</a>
|
||||
<a href="/settings"><%= t('.backtosettings') %></a>
|
||||
</div>
|
||||
<div class="legend">
|
||||
<%= @title %>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Scan the QR code below or click on it to open in your <a
|
||||
href="https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm"
|
||||
target="_blank">TOTP</a> application of choice:
|
||||
<%= raw(t('.scanqrcode')) %>
|
||||
</p>
|
||||
|
||||
<%= raw @qr_svg %>
|
||||
|
||||
<p>
|
||||
Once you have finished registering with your TOTP application, proceed to
|
||||
the next screen to verify your current TOTP code and actually enable
|
||||
Two-Factor Authentication on your account.
|
||||
<%= t('.registring') %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= button_to "Verify and Enable", twofa_verify_url, :method => :get %>
|
||||
<%= button_to t('.verifyenable'), twofa_verify_url, :method => :get %>
|
||||
</div>
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
|
||||
<%= form_tag twofa_update_url do %>
|
||||
<p>
|
||||
To enable Two-Factor Authentication on your account using your new TOTP
|
||||
secret, enter the six-digit code from your TOTP application:
|
||||
<%= t('.enablecode') %>
|
||||
</p>
|
||||
|
||||
<div class="boxline">
|
||||
|
@ -19,6 +18,6 @@
|
|||
</div>
|
||||
|
||||
<p>
|
||||
<%= submit_tag "Verify and Enable" %>
|
||||
<%= submit_tag t('.verifyenable') %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
|
|
@ -292,6 +292,33 @@ en:
|
|||
pushovernorandomtokenurl: "No random token present in URL"
|
||||
accountsetuppushover: "Your account is now setup for Pushover notifications."
|
||||
accountnolongersetuppushover: "Your account is no longer setup for Pushover notifications."
|
||||
twofa:
|
||||
title: "Two-Factor Authentication"
|
||||
backtosettings: "Back to Settings"
|
||||
disable2fa: "Disable Two-Factor Authentication"
|
||||
continue: "Continue"
|
||||
currentpassword: "Current Password:"
|
||||
turnoff: "To turn off two-factor authentication for your account, enter your current password:"
|
||||
turnon: "To begin the two-factor authentication enrollment for your account, enter your current password:"
|
||||
twofa_auth:
|
||||
2fahasbeendisabled: "Two-Factor Authentication has been disabled on your account."
|
||||
2fapassnotcorrect: "Your password was not correct."
|
||||
twofa_enroll:
|
||||
title: "Two-Factor Authentication"
|
||||
backtosettings: "Back to Settings"
|
||||
enrollmenttimeout: "Your enrollment period timed out."
|
||||
scanqrcode: "Scan the QR code below or click on it to open in your <a href=\"https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm\" target=\"_blank\">TOTP</a> application of choice:"
|
||||
registring: "Once you have finished registering with your TOTP application, proceed to the next screen to verify your current TOTP code and actually enable Two-Factor Authentication on your account."
|
||||
verifyenable: "Verify and Enable"
|
||||
twofa_update:
|
||||
enrollmenttimeout: "Your enrollment period timed out."
|
||||
2fahasbeenenabled: "Two-Factor Authentication has been enabled on your account."
|
||||
totpinvalid: "Your TOTP code was invalid, please verify the current code in your TOTP application."
|
||||
twofa_verify:
|
||||
title: "Two-Factor Authentication"
|
||||
enrollmenttimeout: "Your enrollment period timed out."
|
||||
enablecode: "To enable Two-Factor Authentication on your account using your new TOTP secret, enter the six-digit code from your TOTP application:"
|
||||
verifyenable: "Verify and Enable"
|
||||
update:
|
||||
updatesettingsflash: "Successfully updated settings."
|
||||
stories:
|
||||
|
|
|
@ -293,8 +293,8 @@ fr:
|
|||
twofactorauth: "Authentification à deux facteurs :"
|
||||
disable2fa: "Désactiver"
|
||||
enroll2fa: "Activer"
|
||||
disabled2fa: "Désactivé"
|
||||
enabled2fa: "Activé"
|
||||
disabled2fa: "Désactivée"
|
||||
enabled2fa: "Activée"
|
||||
pushover:
|
||||
pushovernotconfigured: "Ce site n'est pas configuré pour le Pushover"
|
||||
pushover_callback:
|
||||
|
@ -302,6 +302,33 @@ fr:
|
|||
pushovernorandomtokenurl: "Pas de jeton alétoire présent dans l'url"
|
||||
accountsetuppushover: "Votre compte est maintenant configuré pour les notifications Pushover."
|
||||
accountnolongersetuppushover: "Votre compte n'est plus configuré pour les notifications Pushover."
|
||||
twofa:
|
||||
title: "Authentification à deux facteurs"
|
||||
backtosettings: "Retour aux paramètres"
|
||||
disable2fa: "Désactiver l'authentification à deux facteurs"
|
||||
continue: "Continuer"
|
||||
currentpassword: "Mot de passe actuel :"
|
||||
turnoff: "Pour désactiver l'authentification à deux facteurs, entrez votre mot de passe actuel :"
|
||||
turnon: "Pour activer l'authentification à deux facteurs pour votre compte, entrez votre mot de passe actuel :"
|
||||
twofa_auth:
|
||||
2fahasbeendisabled: "L'authentification à deux facteurs a été désactivée sur votre compte"
|
||||
2fapassnotcorrect: "Mot de passe incorrect"
|
||||
twofa_enroll:
|
||||
title: "Authentification à deux facteurs"
|
||||
backtosettings: "Retour aux paramètres"
|
||||
enrollmenttimeout: "Le délai d'attente est dépassé"
|
||||
scanqrcode: "Scannez le QR code ci-dessous ou cliquez dessus pour l'ouvrir dans l'application <a href=\"https://en.wikipedia.org/wiki/Time-based_One-time_Password_Algorithm\" target=\"_blank\">TOTP</a> de votre choix :"
|
||||
registring: "Une fois le processus d'enregistrement de vos applications TOTP achevé, passez à l'écran suivant pour vérifier et activer l'authentification à deux facteurs pour votre compte."
|
||||
verifyenable: "Vérifier et Activer"
|
||||
twofa_update:
|
||||
enrollmenttimeout: "Le délai d'attente est dépassé"
|
||||
2fahasbeenenabled: "L'authentification à deux facteurs a été activée sur votre compte"
|
||||
totpinvalid: "Votre code TOTP est invalide, merci de vérifier le code actuellement affiché par votre application TOTP"
|
||||
twofa_verify:
|
||||
title: "Authentification à deux facteurs"
|
||||
enrollmenttimeout: "Le délai d'attente est dépassé"
|
||||
enablecode: "Afin d'activer l'authentification à deux facteurs pour votre compte en utilisant votre nouveau secret TOTP, entrez le code à 6 chiffres de votre application :"
|
||||
verifyenable: "Vérifier et Activer"
|
||||
update:
|
||||
updatesettingsflash: "Paramètres mis à jour avec succès."
|
||||
stories:
|
||||
|
|
Loading…
Reference in a new issue