From 6451495ec60a108610674b419faf5c211b58fbac Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 24 Aug 2015 10:24:09 +1000 Subject: [PATCH] FIX: only override sso name / username if it is supplied --- app/models/discourse_single_sign_on.rb | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/models/discourse_single_sign_on.rb b/app/models/discourse_single_sign_on.rb index 5edfeb6b71d..894d545adae 100644 --- a/app/models/discourse_single_sign_on.rb +++ b/app/models/discourse_single_sign_on.rb @@ -114,12 +114,11 @@ class DiscourseSingleSignOn < SingleSignOn user.email = email end - if SiteSetting.sso_overrides_username && - user.username != username + if SiteSetting.sso_overrides_username && user.username != username && username.present? user.username = UserNameSuggester.suggest(username || name || email, user.username) end - if SiteSetting.sso_overrides_name && user.name != name + if SiteSetting.sso_overrides_name && user.name != name && name.present? user.name = name || User.suggest_name(username.blank? ? email : username) end