ensure usernames do not keep cycling
This commit is contained in:
parent
94fceaf517
commit
0c287d7d6b
|
@ -114,7 +114,9 @@ class DiscourseSingleSignOn < SingleSignOn
|
|||
user.email = email
|
||||
end
|
||||
|
||||
if SiteSetting.sso_overrides_username && user.username != username
|
||||
if SiteSetting.sso_overrides_username &&
|
||||
user.username != username &&
|
||||
user.username != UserNameSuggester.fix_username(username || name || email)
|
||||
user.username = UserNameSuggester.suggest(username || name || email)
|
||||
end
|
||||
|
||||
|
|
|
@ -88,7 +88,9 @@ describe DiscourseSingleSignOn do
|
|||
sso.lookup_or_create_user(ip_address)
|
||||
|
||||
admin.reload
|
||||
|
||||
expect(admin.email).to eq("test@bob.com")
|
||||
expect(admin.username).to eq "bob_the_admin"
|
||||
end
|
||||
|
||||
it "can fill in data on way back" do
|
||||
|
|
Loading…
Reference in New Issue