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