diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-16 16:01:32 +0000 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2016-12-16 16:01:32 +0000 |
commit | fdc944e0b47c67c76cd38b95e1c10c862c77acc6 (patch) | |
tree | 6063b7867646ea48ba515586d949f4b3b4eb8bb1 | |
parent | 01adeb17acccab09eb0074725050356d9d431c8a (diff) | |
parent | 55f224e4e785d0e1515ac4a840e689cb6d9c7d24 (diff) | |
download | gitlab-ce-fdc944e0b47c67c76cd38b95e1c10c862c77acc6.tar.gz |
Merge branch 'add_info_to_qr' into 'master'
Add GitLab host to 2FA QR and manual info
Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/25545
See merge request !6941
-rw-r--r-- | app/controllers/profiles/two_factor_auths_controller.rb | 8 | ||||
-rw-r--r-- | app/views/profiles/two_factor_auths/show.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/add_info_to_qr.yml | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb index 9eb75bb3891..18044ca78e2 100644 --- a/app/controllers/profiles/two_factor_auths_controller.rb +++ b/app/controllers/profiles/two_factor_auths_controller.rb @@ -22,6 +22,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController end @qr_code = build_qr_code + @account_string = account_string setup_u2f_registration end @@ -78,11 +79,14 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController private def build_qr_code - issuer = "#{issuer_host} | #{current_user.email}" - uri = current_user.otp_provisioning_uri(current_user.email, issuer: issuer) + uri = current_user.otp_provisioning_uri(account_string, issuer: issuer_host) RQRCode::render_qrcode(uri, :svg, level: :m, unit: 3) end + def account_string + "#{issuer_host}:#{current_user.email}" + end + def issuer_host Gitlab.config.gitlab.host end diff --git a/app/views/profiles/two_factor_auths/show.html.haml b/app/views/profiles/two_factor_auths/show.html.haml index 03ac739ade5..558a1d56151 100644 --- a/app/views/profiles/two_factor_auths/show.html.haml +++ b/app/views/profiles/two_factor_auths/show.html.haml @@ -30,7 +30,7 @@ To add the entry manually, provide the following details to the application on your phone. %p.prepend-top-0.append-bottom-0 Account: - = current_user.email + = @account_string %p.prepend-top-0.append-bottom-0 Key: = current_user.otp_secret.scan(/.{4}/).join(' ') diff --git a/changelogs/unreleased/add_info_to_qr.yml b/changelogs/unreleased/add_info_to_qr.yml new file mode 100644 index 00000000000..a4b0354a9c9 --- /dev/null +++ b/changelogs/unreleased/add_info_to_qr.yml @@ -0,0 +1,4 @@ +--- +title: Add GitLab host to 2FA QR code and manual info +merge_request: 6941 +author: |