Merge pull request #4300 from NuckChorris/patch-2

Log RecordInvalid when verbose_sso_logging enabled
This commit is contained in:
Sam 2016-07-01 14:12:06 +10:00 committed by GitHub
commit 0c6d8e155c
1 changed files with 8 additions and 0 deletions

View File

@ -126,6 +126,14 @@ class SessionController < ApplicationController
render text: I18n.t("sso.not_found"), status: 500
end
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}
EOF
end
render text: I18n.t("sso.unknown_error"), status: 500
rescue => e
message = "Failed to create or lookup user: #{e}."