Commit 76b7809e authored by Heinrich Lee Yu's avatar Heinrich Lee Yu

Merge branch 'bwill/fix-empty-account-string' into 'master'

Set account string when 2fa creation fails

See merge request gitlab-org/gitlab!84082
parents dc182687 fb94b29e
......@@ -68,6 +68,7 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
else
@error = { message: _('Invalid pin code.') }
@qr_code = build_qr_code
@account_string = account_string
if Feature.enabled?(:webauthn, default_enabled: :yaml)
setup_webauthn_registration
......
......@@ -104,7 +104,7 @@ RSpec.describe Profiles::TwoFactorAuthsController do
expect(subject).to receive(:build_qr_code).and_return(code)
get :show
expect(assigns[:qr_code]).to eq code
expect(assigns[:qr_code]).to eq(code)
end
it 'generates a unique otp_secret every time the page is loaded' do
......@@ -183,7 +183,12 @@ RSpec.describe Profiles::TwoFactorAuthsController do
expect(subject).to receive(:build_qr_code).and_return(code)
go
expect(assigns[:qr_code]).to eq code
expect(assigns[:qr_code]).to eq(code)
end
it 'assigns account_string' do
go
expect(assigns[:account_string]).to eq("#{Gitlab.config.gitlab.host}:#{user.email}")
end
it 'renders show' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment