summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-03-22 15:59:03 +0100
committerRémy Coutable <remy@rymai.me>2017-03-22 17:06:19 +0100
commit8b6041bce31750aeffbaca70950c36188b6639d1 (patch)
treeca556a6c76eb003343bcc7c5c73c642f375d164b /app/models
parentc62314ab6419f2f61b1acb5287de51cf2d459791 (diff)
downloadgitlab-ce-8b6041bce31750aeffbaca70950c36188b6639d1.tar.gz
Don't try to find a user by personal_access_token if the token is nil
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'app/models')
-rw-r--r--app/models/user.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 8c7ad5d5174..5d19d873f43 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -324,6 +324,8 @@ class User < ActiveRecord::Base
end
def find_by_personal_access_token(token_string)
+ return unless token_string
+
PersonalAccessTokensFinder.new(state: 'active').find_by(token: token_string)&.user
end