summaryrefslogtreecommitdiff
path: root/app/helpers
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/helpers
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/helpers')
-rw-r--r--app/helpers/u2f_helper.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/helpers/u2f_helper.rb b/app/helpers/u2f_helper.rb
new file mode 100644
index 00000000000..143b4ca6b51
--- /dev/null
+++ b/app/helpers/u2f_helper.rb
@@ -0,0 +1,5 @@
+module U2fHelper
+ def inject_u2f_api?
+ browser.chrome? && browser.version.to_i >= 41 && !browser.device.mobile?
+ end
+end