From 0b4c9005f95fe58363045302b6806e5e37488ed0 Mon Sep 17 00:00:00 2001 From: Robin Ward Date: Thu, 29 Oct 2015 12:19:09 -0400 Subject: [PATCH] FIX: Don't include `name` in hash when names are disabled. This could break some SSO implementations due to honeypot not being triggered. --- lib/auth/result.rb | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/lib/auth/result.rb b/lib/auth/result.rb index 461c8f7c9..3c78b2cf5 100644 --- a/lib/auth/result.rb +++ b/lib/auth/result.rb @@ -46,15 +46,18 @@ class Auth::Result } end else - { - email: email, - name: User.suggest_name(name || username || email), - username: UserNameSuggester.suggest(username || name || email), - # this feels a tad wrong - auth_provider: authenticator_name.capitalize, - email_valid: !!email_valid, - omit_username: !!omit_username - } + result = { email: email, + username: UserNameSuggester.suggest(username || name || email), + # this feels a tad wrong + auth_provider: authenticator_name.capitalize, + email_valid: !!email_valid, + omit_username: !!omit_username } + + if SiteSetting.enable_names? + result[:name] = User.suggest_name(name || username || email) + end + + result end end end