FEATURE: add website field to SSO

This commit is contained in:
David Lee 2018-06-19 17:30:23 -07:00 committed by Sam
parent 329c94a354
commit 4644d777bd
3 changed files with 8 additions and 1 deletions

View File

@ -92,6 +92,11 @@ class DiscourseSingleSignOn < SingleSignOn
user.user_profile.save!
end
if website
user.user_profile.website = website
user.user_profile.save!
end
unless admin.nil? && moderator.nil?
Group.refresh_automatic_groups!(:admins, :moderators, :staff)
end

View File

@ -1,7 +1,7 @@
class SingleSignOn
ACCESSORS = [:nonce, :name, :username, :email, :avatar_url, :avatar_force_update, :require_activation,
:bio, :external_id, :return_sso_url, :admin, :moderator, :suppress_welcome_message, :title,
:add_groups, :remove_groups, :groups, :profile_background_url, :card_background_url]
:add_groups, :remove_groups, :groups, :profile_background_url, :card_background_url, :website]
FIXNUMS = []
BOOLS = [:avatar_force_update, :admin, :moderator, :require_activation, :suppress_welcome_message]
NONCE_EXPIRY_TIME = 10.minutes

View File

@ -30,6 +30,7 @@ describe DiscourseSingleSignOn do
sso.title = "user title"
sso.custom_fields["a"] = "Aa"
sso.custom_fields["b.b"] = "B.b"
sso.website = "https://www.discourse.org/"
sso
end
@ -49,6 +50,7 @@ describe DiscourseSingleSignOn do
expect(parsed.title).to eq sso.title
expect(parsed.custom_fields["a"]).to eq "Aa"
expect(parsed.custom_fields["b.b"]).to eq "B.b"
expect(parsed.website).to eq sso.website
end
it "can do round trip parsing correctly" do