Fix codeclimate issues

This commit is contained in:
Maciej Szlosarczyk 2018-07-24 12:18:38 +03:00
parent 06f5eb10d4
commit 90b2455032
No known key found for this signature in database
GPG key ID: 41D62D42D3B0D765
5 changed files with 13 additions and 14 deletions

View file

@ -19,7 +19,7 @@ module API
def bearer_token
pattern = /^Bearer /
header = request.headers['Authorization']
header.gsub(pattern, '') if header && header.match(pattern)
header.gsub(pattern, '') if header&.match(pattern)
end
def authenticate
@ -29,7 +29,7 @@ module API
if decryptor.valid?
sign_in decryptor.user
else
render json: { error: 'Not authorized' }, status: 401
render json: { error: 'Not authorized' }, status: :unauthorized
end
end
end