Raise error if sso record fails to create.

This commit is contained in:
Guo Xiang Tan 2017-11-07 18:38:38 +08:00
parent 8970bdd4fa
commit 95c891cf11
1 changed files with 9 additions and 2 deletions

View File

@ -149,8 +149,15 @@ class DiscourseSingleSignOn < SingleSignOn
sso_record.last_payload = unsigned_payload
sso_record.external_id = external_id
else
Jobs.enqueue(:download_avatar_from_url, url: avatar_url, user_id: user.id, override_gravatar: SiteSetting.sso_overrides_avatar) if avatar_url.present?
user.create_single_sign_on_record(
if avatar_url.present?
Jobs.enqueue(:download_avatar_from_url,
url: avatar_url,
user_id: user.id,
override_gravatar: SiteSetting.sso_overrides_avatar
)
end
user.create_single_sign_on_record!(
last_payload: unsigned_payload,
external_id: external_id,
external_username: username,