FIX: extract and fix overriding of usernames by external auth (#14637)

This commit is contained in:
Andrei Prigorshnev
2021-12-02 14:42:23 +01:00
committed by GitHub
parent ceca34aca6
commit 1c0022c195
6 changed files with 128 additions and 9 deletions

View File

@@ -77,9 +77,8 @@ class Auth::Result
def apply_user_attributes!
change_made = false
if SiteSetting.auth_overrides_username? && username.present? && UserNameSuggester.fix_username(username) != user.username
user.username = UserNameSuggester.suggest(username)
change_made = true
if SiteSetting.auth_overrides_username? && username.present?
change_made = UsernameChanger.override(user, username)
end
if SiteSetting.auth_overrides_email && email_valid && email.present? && user.email != Email.downcase(email)