Skip bearer token logging when production env

This commit is contained in:
Karl Erik Õunapuu 2021-02-23 15:09:50 +02:00
parent f60bf4013c
commit 34e71cc2c8
No known key found for this signature in database
GPG key ID: C9DD647298A34764

View file

@ -19,8 +19,9 @@ module Api
token = create_token(user)
if token
ToStdout.msg("Bearer for #{eid_params[:first_name]} #{eid_params[:last_name]} " \
"(#{eid_params[:ident]}) - '#{token[:access_token]}'")
msg = "Bearer for #{eid_params[:first_name]} #{eid_params[:last_name]} " \
"(#{eid_params[:ident]}) - '#{token[:access_token]}'"
ToStdout.msg(msg) unless Rails.env.production?
render json: token
else
render json: { errors: [{ base: ['Cannot create generate session token'] }] }