FIX: sso with avatar override may fail on first account creation

This commit is contained in:
Sam 2014-11-21 11:36:14 +11:00
parent 508efe3029
commit 034967328c
1 changed files with 4 additions and 0 deletions

View File

@ -134,6 +134,10 @@ class DiscourseSingleSignOn < SingleSignOn
upload = Upload.create_for(user.id, tempfile, "external-avatar." + ext, File.size(tempfile.path), { origin: avatar_url })
user.uploaded_avatar_id = upload.id
unless user.user_avatar
user.build_user_avatar
end
if !user.user_avatar.contains_upload?(upload.id)
user.user_avatar.custom_upload_id = upload.id
end