Don't look for personal access tokens in the DB when the parameter/header is not passed.

This commit is contained in:
Timothy Andrew 2016-06-01 14:09:17 +05:30
parent 05b319b0b4
commit 6d44433176

View file

@ -374,7 +374,7 @@ class ApplicationController < ActionController::Base
def get_user_from_personal_access_token def get_user_from_personal_access_token
token_string = params[:private_token].presence || request.headers['PRIVATE-TOKEN'].presence token_string = params[:private_token].presence || request.headers['PRIVATE-TOKEN'].presence
personal_access_token = PersonalAccessToken.active.find_by_token(token_string) personal_access_token = PersonalAccessToken.active.find_by_token(token_string) if token_string
personal_access_token.user if personal_access_token personal_access_token.user if personal_access_token
end end
end end