Browse Source

Merge pull request #594 from communitiesuk/no_two_factor_authentication_for_dev_env

No two factor authentication for development environment
pull/596/head
J G 3 years ago committed by GitHub
parent
commit
739ab3eb69
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      app/models/user.rb
  2. 12
      spec/models/user_spec.rb

2
app/models/user.rb

@ -90,6 +90,8 @@ class User < ApplicationRecord
end
def need_two_factor_authentication?(_request)
return false if Rails.env.development?
support?
end

12
spec/models/user_spec.rb

@ -140,6 +140,18 @@ RSpec.describe User, type: :model do
expect(user.case_logs_filters).to eq(%w[status years user organisation])
end
end
context "when the user is in development environment" do
let(:user) { FactoryBot.create(:user, :support) }
before do
allow(Rails.env).to receive(:development?).and_return(true)
end
it "does not require 2FA" do
expect(user.need_two_factor_authentication?(nil)).to be false
end
end
end
describe "paper trail" do

Loading…
Cancel
Save