FIX: SSO email match should be case insensitive
This commit is contained in:
parent
0bb07d395a
commit
b21d5d3633
|
@ -176,7 +176,7 @@ class DiscourseSingleSignOn < SingleSignOn
|
|||
end
|
||||
|
||||
def change_external_attributes_and_override(sso_record, user)
|
||||
if SiteSetting.sso_overrides_email && user.email != email
|
||||
if SiteSetting.sso_overrides_email && user.email != Email.downcase(email)
|
||||
user.email = email
|
||||
user.active = false if require_activation
|
||||
end
|
||||
|
|
|
@ -266,6 +266,23 @@ describe DiscourseSingleSignOn do
|
|||
expect(user.active).to eq(false)
|
||||
end
|
||||
|
||||
it 'does not deactivate user if email provided is capitalized' do
|
||||
SiteSetting.email_editable = false
|
||||
SiteSetting.sso_overrides_email = true
|
||||
sso.require_activation = true
|
||||
|
||||
user = sso.lookup_or_create_user(ip_address)
|
||||
expect(user.active).to eq(false)
|
||||
|
||||
user.update_columns(active: true)
|
||||
user = sso.lookup_or_create_user(ip_address)
|
||||
expect(user.active).to eq(true)
|
||||
|
||||
sso.email = "Test@example.com"
|
||||
user = sso.lookup_or_create_user(ip_address)
|
||||
expect(user.active).to eq(true)
|
||||
end
|
||||
|
||||
it 'deactivates accounts that have updated email address' do
|
||||
|
||||
SiteSetting.email_editable = false
|
||||
|
|
Loading…
Reference in New Issue