Commit dbedf3a6 authored by Timothy Andrew's avatar Timothy Andrew

Address review comments from @smcgivern.

1. Remove an unnecessary (since we're fetching all the records anyway)
   `pluck` while fetching U2F registration records.

2. Align "Your device was successfully set up!" section with the "U2F
   Devices" table below.
parent a41cf621
...@@ -92,11 +92,10 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController ...@@ -92,11 +92,10 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
def setup_u2f_registration def setup_u2f_registration
@u2f_registration ||= U2fRegistration.new @u2f_registration ||= U2fRegistration.new
@u2f_registrations = current_user.u2f_registrations @u2f_registrations = current_user.u2f_registrations
@registration_key_handles = @u2f_registrations.pluck(:key_handle)
u2f = U2F::U2F.new(u2f_app_id) u2f = U2F::U2F.new(u2f_app_id)
registration_requests = u2f.registration_requests registration_requests = u2f.registration_requests
sign_requests = u2f.authentication_requests(@registration_key_handles) sign_requests = u2f.authentication_requests(@u2f_registrations.map(&:key_handle))
session[:challenges] = registration_requests.map(&:challenge) session[:challenges] = registration_requests.map(&:challenge)
gon.push(u2f: { challenges: session[:challenges], app_id: u2f_app_id, gon.push(u2f: { challenges: session[:challenges], app_id: u2f_app_id,
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
%script#js-register-u2f-registered{ type: "text/template" } %script#js-register-u2f-registered{ type: "text/template" }
%div.row.append-bottom-10 %div.row.append-bottom-10
.col-md-12
%p Your device was successfully set up! Give it a name and register it with the GitLab server. %p Your device was successfully set up! Give it a name and register it with the GitLab server.
= form_tag(create_u2f_profile_two_factor_auth_path, method: :post) do = form_tag(create_u2f_profile_two_factor_auth_path, method: :post) do
.row.append-bottom-10 .row.append-bottom-10
......
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