summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-08-18 12:28:36 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-08-18 22:12:02 +0530
commitdbedf3a61b5fe233b87b217596dea5572fc741b3 (patch)
tree2e94353c983f50cee38116e1a98df368e108cb18
parenta41cf621f5e4719f81efad603f0bc91f8fbe5f40 (diff)
downloadgitlab-ce-17334-u2f-device-identifiers.tar.gz
Address review comments from @smcgivern.17334-u2f-device-identifiers
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.
-rw-r--r--app/controllers/profiles/two_factor_auths_controller.rb3
-rw-r--r--app/views/u2f/_register.html.haml17
2 files changed, 10 insertions, 10 deletions
diff --git a/app/controllers/profiles/two_factor_auths_controller.rb b/app/controllers/profiles/two_factor_auths_controller.rb
index cfa84c3bf4d..9eb75bb3891 100644
--- a/app/controllers/profiles/two_factor_auths_controller.rb
+++ b/app/controllers/profiles/two_factor_auths_controller.rb
@@ -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,
diff --git a/app/views/u2f/_register.html.haml b/app/views/u2f/_register.html.haml
index 7a4b7d7a77a..8f7b42eb351 100644
--- a/app/views/u2f/_register.html.haml
+++ b/app/views/u2f/_register.html.haml
@@ -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);