Implement SSO overriding avatars.

Implemented by having Discourse download the image from the provided URL
and treating it as a custom upload.

Adds two more parameters to the SSO site’s response:

* `avatar_url` specifies the URL of the overriding avatar.
* `avatar_force_update` Discourse does not re-download avatars that
has already been download from the same URL. Setting this to true forces
Discourse to re-download the avatar in `avatar_url`

Note that both parameters are ignored if `sso_overrides_avatar` is set
to false.
This commit is contained in:
Wilhansen Li
2014-08-19 15:49:14 +08:00
parent 76e74f6a3b
commit e0f970326f
8 changed files with 46 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
class SingleSignOn
ACCESSORS = [:nonce, :name, :username, :email,
ACCESSORS = [:nonce, :name, :username, :email, :avatar_url, :avatar_force_update,
:about_me, :external_id]
FIXNUMS = []
NONCE_EXPIRY_TIME = 10.minutes