Commit 4970a66b authored by Douwe Maan's avatar Douwe Maan

Merge branch 'bvl-fix-ldap-login' into 'master'

Fix setting `last_credential_check_at` on LDAP-login

See merge request !12507
parents fb093e8b d2eb5bbd
......@@ -16,7 +16,7 @@ def self.open(user, &block)
def self.allowed?(user)
self.open(user) do |access|
if access.allowed?
Users::UpdateService.new(user, last_credential_check_a: Time.now).execute
Users::UpdateService.new(user, last_credential_check_at: Time.now).execute
true
else
......
......@@ -4,6 +4,16 @@
let(:access) { Gitlab::LDAP::Access.new user }
let(:user) { create(:omniauth_user) }
describe '.allowed?' do
it 'updates the users `last_credential_check_at' do
expect(access).to receive(:allowed?) { true }
expect(described_class).to receive(:open).and_yield(access)
expect { described_class.allowed?(user) }
.to change { user.last_credential_check_at }
end
end
describe '#allowed?' do
subject { access.allowed? }
......
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