mirror of
https://github.com/discourse/discourse.git
synced 2026-08-09 04:28:29 -05:00
FEATURE: Optionally skip using full_name when suggesting usernames (#16592)
This commit introduces a new site setting: `use_name_for_username_suggestions` (default true) Admins can disable it if they want to stop using Name values when generating usernames for users. This can be useful if you want to keep real names private-by-default or, when used in conjunction with the `use_email_for_username_and_name_suggestions` setting, you would prefer to use email-based username suggestions.
This commit is contained in:
@@ -450,6 +450,20 @@ describe DiscourseConnect do
|
||||
expect(user.username).to eq sso.name
|
||||
end
|
||||
|
||||
it "stops using name as a source for username suggestions when disabled" do
|
||||
SiteSetting.use_name_for_username_suggestions = false
|
||||
|
||||
sso = new_discourse_sso
|
||||
sso.external_id = "100"
|
||||
|
||||
sso.username = nil
|
||||
sso.name = "John Smith"
|
||||
sso.email = "mail@mail.com"
|
||||
|
||||
user = sso.lookup_or_create_user(ip_address)
|
||||
expect(user.username).to eq "user"
|
||||
end
|
||||
|
||||
it "doesn't use email as a source for username suggestions by default" do
|
||||
sso = new_discourse_sso
|
||||
sso.external_id = "100"
|
||||
|
||||
Reference in New Issue
Block a user