Skip to content
Snippets Groups Projects
Commit dbedf3a6 authored by Timothy Andrew's avatar Timothy Andrew
Browse files

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
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -92,11 +92,10 @@ class Profiles::TwoFactorAuthsController < Profiles::ApplicationController
def setup_u2f_registration
@u2f_registration ||= U2fRegistration.new
@u2f_registrations = current_user.u2f_registrations
@registration_key_handles = @u2f_registrations.pluck(:key_handle)
u2f = U2F::U2F.new(u2f_app_id)
 
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)
 
gon.push(u2f: { challenges: session[:challenges], app_id: u2f_app_id,
Loading
Loading
Loading
Loading
@@ -28,14 +28,15 @@
 
%script#js-register-u2f-registered{ type: "text/template" }
%div.row.append-bottom-10
%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
.row.append-bottom-10
.col-md-3
= text_field_tag 'u2f_registration[name]', nil, class: 'form-control', placeholder: "Pick a name"
.col-md-3
= hidden_field_tag 'u2f_registration[device_response]', nil, class: 'form-control', required: true, id: "js-device-response"
= submit_tag "Register U2F Device", class: "btn btn-success"
.col-md-12
%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
.row.append-bottom-10
.col-md-3
= text_field_tag 'u2f_registration[name]', nil, class: 'form-control', placeholder: "Pick a name"
.col-md-3
= hidden_field_tag 'u2f_registration[device_response]', nil, class: 'form-control', required: true, id: "js-device-response"
= submit_tag "Register U2F Device", class: "btn btn-success"
 
:javascript
var u2fRegister = new U2FRegister($("#js-register-u2f"), gon.u2f);
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment