From 242e77e070c25fd45896bdd7be6edac4679ec2b2 Mon Sep 17 00:00:00 2001 From: Kamil Trzcinski Date: Tue, 20 Sep 2016 09:41:21 +0200 Subject: [PATCH] Use early return in lfs_token_check --- lib/gitlab/auth.rb | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/gitlab/auth.rb b/lib/gitlab/auth.rb index 4458112ed44..7c0f2115d43 100644 --- a/lib/gitlab/auth.rb +++ b/lib/gitlab/auth.rb @@ -113,18 +113,18 @@ module Gitlab User.by_login(login) end - if actor - token_handler = Gitlab::LfsToken.new(actor) + return unless actor - authentication_abilities = - if token_handler.user? - full_authentication_abilities - else - read_authentication_abilities - end + token_handler = Gitlab::LfsToken.new(actor) - Result.new(actor, nil, token_handler.type, authentication_abilities) if Devise.secure_compare(token_handler.value, password) - end + authentication_abilities = + if token_handler.user? + full_authentication_abilities + else + read_authentication_abilities + end + + Result.new(actor, nil, token_handler.type, authentication_abilities) if Devise.secure_compare(token_handler.value, password) end def build_access_token_check(login, password) -- GitLab