FIX: sso with avatar override may fail on first account creation
This commit is contained in:
parent
508efe3029
commit
034967328c
|
@ -134,6 +134,10 @@ class DiscourseSingleSignOn < SingleSignOn
|
||||||
upload = Upload.create_for(user.id, tempfile, "external-avatar." + ext, File.size(tempfile.path), { origin: avatar_url })
|
upload = Upload.create_for(user.id, tempfile, "external-avatar." + ext, File.size(tempfile.path), { origin: avatar_url })
|
||||||
user.uploaded_avatar_id = upload.id
|
user.uploaded_avatar_id = upload.id
|
||||||
|
|
||||||
|
unless user.user_avatar
|
||||||
|
user.build_user_avatar
|
||||||
|
end
|
||||||
|
|
||||||
if !user.user_avatar.contains_upload?(upload.id)
|
if !user.user_avatar.contains_upload?(upload.id)
|
||||||
user.user_avatar.custom_upload_id = upload.id
|
user.user_avatar.custom_upload_id = upload.id
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue