]> cat aescling's git repositories - mastodon.git/commitdiff
Fix #587 - Display TOTP secret next to QR code
authorEugen Rochko <eugen@zeonfederated.com>
Mon, 13 Feb 2017 19:56:03 +0000 (20:56 +0100)
committerEugen Rochko <eugen@zeonfederated.com>
Mon, 13 Feb 2017 19:56:03 +0000 (20:56 +0100)
app/controllers/settings/two_factor_auths_controller.rb
app/views/settings/two_factor_auths/show.html.haml
config/locales/en.yml

index f34295cb9309cc26954dad5e77c2644c43e28536..cfee92391a7b02aec3b48fa4eedc33479271da4c 100644 (file)
@@ -8,7 +8,8 @@ class Settings::TwoFactorAuthsController < ApplicationController
   def show
     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
 
   def enable
index bad359f8f995b64e7a8eee2f7a58d679d3a9a49a..646369a97d1d20fec31d8957ba93468e1ca4639d 100644 (file)
@@ -7,6 +7,10 @@
 
     .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'
   - else
     %p= t('two_factor_auth.description_html')
index c6c7c236e7e71839475ffa2ff2718b7ec310bff5..e7d39327eaa58126f66af05f296a6a126f7d9b5f 100644 (file)
@@ -118,6 +118,8 @@ en:
     disable: Disable
     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."
+    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:
     invalid_email: The e-mail address is invalid
     invalid_otp_token: Invalid two-factor code