Fix #587 - Display TOTP secret next to QR code

remotes/1727458204337373841/tmp_refs/heads/signup-info-prompt
Eugen Rochko 2017-02-13 20:56:03 +01:00
parent bae7cf8cce
commit 63886bdc59
3 changed files with 8 additions and 1 deletions

View File

@ -8,7 +8,8 @@ class Settings::TwoFactorAuthsController < ApplicationController
def show def show
return unless current_user.otp_required_for_login return unless current_user.otp_required_for_login
@qrcode = RQRCode::QRCode.new(current_user.otp_provisioning_uri(current_user.email, issuer: Rails.configuration.x.local_domain)) @provision_url = current_user.otp_provisioning_uri(current_user.email, issuer: Rails.configuration.x.local_domain)
@qrcode = RQRCode::QRCode.new(@provision_url)
end end
def enable def enable

View File

@ -7,6 +7,10 @@
.qr-code= raw @qrcode.as_svg(padding: 0, module_size: 5) .qr-code= raw @qrcode.as_svg(padding: 0, module_size: 5)
%p= t('two_factor_auth.plaintext_secret_html', secret: current_user.otp_secret)
%p= t('two_factor_auth.warning')
= link_to t('two_factor_auth.disable'), disable_settings_two_factor_auth_path, data: { method: 'POST' }, class: 'block-button' = link_to t('two_factor_auth.disable'), disable_settings_two_factor_auth_path, data: { method: 'POST' }, class: 'block-button'
- else - else
%p= t('two_factor_auth.description_html') %p= t('two_factor_auth.description_html')

View File

@ -118,6 +118,8 @@ en:
disable: Disable disable: Disable
enable: Enable enable: Enable
instructions_html: "<strong>Scan this QR code into Google Authenticator or a similiar app on your phone</strong>. From now on, that app will generate tokens that you will have to enter when logging in." instructions_html: "<strong>Scan this QR code into Google Authenticator or a similiar app on your phone</strong>. From now on, that app will generate tokens that you will have to enter when logging in."
plaintext_secret_html: "Plain-text secret: <samp>%{secret}</samp>"
warning: If you cannot configure an authenticator app right now, you should click "disable" or you won't be able to login.
users: users:
invalid_email: The e-mail address is invalid invalid_email: The e-mail address is invalid
invalid_otp_token: Invalid two-factor code invalid_otp_token: Invalid two-factor code