about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorEffy Elden <github@effy.is>2018-03-07 16:19:10 +1100
committerEugen Rochko <eugen@zeonfederated.com>2018-03-07 06:19:10 +0100
commitdd9d00d293c127fd84183e4fc30690aea4913e02 (patch)
tree4b4f2332fca2cca9f85abe2a6d4bf7897ab9ea67 /app
parent89a52d6280e0643605613e507cd045ce17d7b625 (diff)
Add additional first_name and last_name SAML attribute statement options, and modify Omniauthable concern to use full_name or first_name + last_name if not available (#6669)
Diffstat (limited to 'app')
-rw-r--r--app/models/concerns/omniauthable.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/concerns/omniauthable.rb b/app/models/concerns/omniauthable.rb
index 87d93c1fd..50288e700 100644
--- a/app/models/concerns/omniauthable.rb
+++ b/app/models/concerns/omniauthable.rb
@@ -58,13 +58,14 @@ module Omniauthable
       email_is_verified = auth.info.verified || auth.info.verified_email || assume_verified
       email             = auth.info.verified_email || auth.info.email
       email             = email_is_verified && !User.exists?(email: auth.info.email) && email
+      display_name      = auth.info.full_name || [auth.info.first_name, auth.info.last_name].join(' ')
 
       {
         email: email ? email : "#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com",
         password: Devise.friendly_token[0, 20],
         account_attributes: {
           username: ensure_unique_username(auth.uid),
-          display_name: [auth.info.first_name, auth.info.last_name].join(' '),
+          display_name: display_name,
         },
       }
     end