summaryrefslogtreecommitdiff
path: root/app/assets
diff options
context:
space:
mode:
authorTimothy Andrew <mail@timothyandrew.net>2016-07-11 13:00:22 +0530
committerTimothy Andrew <mail@timothyandrew.net>2016-07-14 08:19:09 +0530
commit4b33c4c6d1aa529ec22606995123cfa3a151ccee (patch)
tree3b8a555e88995454e9db663bd35cd5c3eb5ab6f8 /app/assets
parentdf49492fc011bd74ebaa4cb82bd85252127859a0 (diff)
downloadgitlab-ce-4b33c4c6d1aa529ec22606995123cfa3a151ccee.tar.gz
Load Javascript U2F library selectively.
1. Only on supported Chrome versions 2. Mainly, this lets us simplify the javascript-based U2F check to `window.u2f`, where `window.u2f` can either be loaded from the GitLab server (for Chrome) or from the Firefox extension. 3. This is a better way to provide browser detection for U2F.
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/application.js.coffee1
-rw-r--r--app/assets/javascripts/u2f/util.js.coffee.erb14
2 files changed, 1 insertions, 14 deletions
diff --git a/app/assets/javascripts/application.js.coffee b/app/assets/javascripts/application.js.coffee
index 64da503c35f..4393fece329 100644
--- a/app/assets/javascripts/application.js.coffee
+++ b/app/assets/javascripts/application.js.coffee
@@ -54,7 +54,6 @@
#= require_directory ./u2f
#= require_directory .
#= require fuzzaldrin-plus
-#= require u2f
window.slugify = (text) ->
text.replace(/[^-a-zA-Z0-9]+/g, '_').toLowerCase()
diff --git a/app/assets/javascripts/u2f/util.js.coffee.erb b/app/assets/javascripts/u2f/util.js.coffee.erb
index d59341c38b9..be1d3286b01 100644
--- a/app/assets/javascripts/u2f/util.js.coffee.erb
+++ b/app/assets/javascripts/u2f/util.js.coffee.erb
@@ -1,15 +1,3 @@
-# Helper class for U2F (universal 2nd factor) device registration and authentication.
-
class @U2FUtil
@isU2FSupported: ->
- if @testMode
- true
- else
- gon.u2f.browser_supports_u2f
-
- @enableTestMode: ->
- @testMode = true
-
-<% if Rails.env.test? %>
-U2FUtil.enableTestMode();
-<% end %>
+ window.u2f