Improve SSO verbose log when user record is invalid.

This commit is contained in:
Guo Xiang Tan 2017-04-13 11:39:26 +08:00
parent 72c16967e6
commit ee449b0dd5
1 changed files with 9 additions and 6 deletions

View File

@ -137,15 +137,18 @@ class SessionController < ApplicationController
rescue ActiveRecord::RecordInvalid => e
if SiteSetting.verbose_sso_logging
Rails.logger.warn(<<-EOF)
Verbose SSO log: Record was invalid: #{e.record.class.name} #{e.record.id}\n
#{e.record.errors.to_h}\n
\n
#{sso.diagnostics}
Rails.logger.warn(<<~EOF)
Verbose SSO log: Record was invalid: #{e.record.class.name} #{e.record.id}
#{e.record.errors.to_h}
Attributes:
#{e.record.attributes.slice(*SingleSignOn::ACCESSORS.map(&:to_s))}
SSO Diagnostics:
#{sso.diagnostics}
EOF
end
text = nil
# If there's a problem with the email we can explain that