mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 15:16:19 +08:00
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
Block a user