summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDJ Mountney <david@twkie.net>2016-08-19 18:51:56 -0700
committerDJ Mountney <david@twkie.net>2016-09-01 17:11:42 -0700
commit9224f031cfcb8283566f9d1dcc336ae644faf062 (patch)
tree4c2012f873b24bd30b6fdea0807cae6d3fe43f4e /app
parent33a367e828c95ba7321d33361be67c68b1603bdd (diff)
downloadgitlab-ce-9224f031cfcb8283566f9d1dcc336ae644faf062.tar.gz
Pass the remember_me option into the u2f form and support it while authenticatingadd-remember-option-u2f
Matches the changes done for non-u2f two-factor auth
Diffstat (limited to 'app')
-rw-r--r--app/controllers/concerns/authenticates_with_two_factor.rb1
-rw-r--r--app/views/devise/sessions/two_factor.html.haml3
-rw-r--r--app/views/u2f/_authenticate.html.haml2
3 files changed, 4 insertions, 2 deletions
diff --git a/app/controllers/concerns/authenticates_with_two_factor.rb b/app/controllers/concerns/authenticates_with_two_factor.rb
index ba07cea569c..d5a8a962662 100644
--- a/app/controllers/concerns/authenticates_with_two_factor.rb
+++ b/app/controllers/concerns/authenticates_with_two_factor.rb
@@ -62,6 +62,7 @@ module AuthenticatesWithTwoFactor
session.delete(:otp_user_id)
session.delete(:challenges)
+ remember_me(user) if user_params[:remember_me] == '1'
sign_in(user)
else
flash.now[:alert] = 'Authentication via U2F device failed.'
diff --git a/app/views/devise/sessions/two_factor.html.haml b/app/views/devise/sessions/two_factor.html.haml
index 4debd3d608f..e623f7cff88 100644
--- a/app/views/devise/sessions/two_factor.html.haml
+++ b/app/views/devise/sessions/two_factor.html.haml
@@ -18,6 +18,5 @@
= f.submit "Verify code", class: "btn btn-save"
- if @user.two_factor_u2f_enabled?
-
%hr
- = render "u2f/authenticate"
+ = render "u2f/authenticate", locals: { params: params, resource: resource, resource_name: resource_name }
diff --git a/app/views/u2f/_authenticate.html.haml b/app/views/u2f/_authenticate.html.haml
index 75fb0e303ad..9657101ace5 100644
--- a/app/views/u2f/_authenticate.html.haml
+++ b/app/views/u2f/_authenticate.html.haml
@@ -20,6 +20,8 @@
%div
%p We heard back from your U2F device. Click this button to authenticate with the GitLab server.
= form_tag(new_user_session_path, method: :post) do |f|
+ - resource_params = params[resource_name].presence || params
+ = hidden_field_tag 'user[remember_me]', resource_params.fetch(:remember_me, 0)
= hidden_field_tag 'user[device_response]', nil, class: 'form-control', required: true, id: "js-device-response"
= submit_tag "Authenticate via U2F Device", class: "btn btn-success"