Commit a87d619a authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'operau2f' into 'master'

Fix FIDO U2F for Opera browser (based on !10118)

See merge request !12082
parents 9cb3510a ef77fcf9
module U2fHelper module U2fHelper
def inject_u2f_api? def inject_u2f_api?
browser.chrome? && browser.version.to_i >= 41 && !browser.device.mobile? ((browser.chrome? && browser.version.to_i >= 41) || (browser.opera? && browser.version.to_i >= 40)) && !browser.device.mobile?
end end
end end
---
title: Fix FIDO U2F for Opera browser
merge_request: 12082
author: Jakub Kramarz and Jonas Kalderstam
require 'spec_helper'
describe U2fHelper do
describe 'when not on mobile' do
it 'does not inject u2f on chrome 40' do
device = double(mobile?: false)
browser = double(chrome?: true, opera?: false, version: 40, device: device)
allow(helper).to receive(:browser).and_return(browser)
expect(helper.inject_u2f_api?).to eq false
end
it 'injects u2f on chrome 41' do
device = double(mobile?: false)
browser = double(chrome?: true, opera?: false, version: 41, device: device)
allow(helper).to receive(:browser).and_return(browser)
expect(helper.inject_u2f_api?).to eq true
end
it 'does not inject u2f on opera 39' do
device = double(mobile?: false)
browser = double(chrome?: false, opera?: true, version: 39, device: device)
allow(helper).to receive(:browser).and_return(browser)
expect(helper.inject_u2f_api?).to eq false
end
it 'injects u2f on opera 40' do
device = double(mobile?: false)
browser = double(chrome?: false, opera?: true, version: 40, device: device)
allow(helper).to receive(:browser).and_return(browser)
expect(helper.inject_u2f_api?).to eq true
end
end
describe 'when on mobile' do
it 'does not inject u2f on chrome 41' do
device = double(mobile?: true)
browser = double(chrome?: true, opera?: false, version: 41, device: device)
allow(helper).to receive(:browser).and_return(browser)
expect(helper.inject_u2f_api?).to eq false
end
it 'does not inject u2f on opera 40' do
device = double(mobile?: true)
browser = double(chrome?: false, opera?: true, version: 40, device: device)
allow(helper).to receive(:browser).and_return(browser)
expect(helper.inject_u2f_api?).to eq false
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment