# Populating Full Name with Email Address if Left Blank by SSO

**URL:** https://meta.discourse.org/t/populating-full-name-with-email-address-if-left-blank-by-sso/50710
**Category:** Feature
**Tags:** pr-welcome
**Created:** [2016 年 9 月 27 日午前 8:56 UTC](https://meta.discourse.org/t/populating-full-name-with-email-address-if-left-blank-by-sso/50710 "2016-09-27T08:56:45Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Er00](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/er00/32/42921_2.png) [@Er00](https://meta.discourse.org/u/Er00)
#### Post date: [2016 年 9 月 27 日午前 8:56 UTC](https://meta.discourse.org/t/populating-full-name-with-email-address-if-left-blank-by-sso/50710/1 "2016-09-27T08:56:45Z")

</div>

Continuing the discussion from ["Full Name" Shown on /About With Full Name Option Disabled](https://meta.discourse.org/t/full-name-shown-on-about-with-full-name-option-disabled/50385/16):

It seems (from our experience and one other poster in the above thread) that the behaviour when Discourse isn’t passed a full name by SSO (which is an optional field) is that it populates that field with the email address.

This seems like a bug (it should probably be left blank, or if it’s required by the settings then populated with username).

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [2016 年 9 月 30 日午後 4:51 UTC](https://meta.discourse.org/t/populating-full-name-with-email-address-if-left-blank-by-sso/50710/2 "2016-09-30T16:51:41Z")

</div>

I’m trying to repro this but looks like this isn’t the case.

[https://github.com/discourse/discourse/blob/master/app/models/discourse\_single\_sign\_on.rb#L109](https://github.com/discourse/discourse/blob/master/app/models/discourse_single_sign_on.rb#L109)

The only way to have an entire email address on the name would be a improperly configured SSO passsing the email on the username field, since User.suggest\_name will remove everything after the **@**.

---

<div class="post-metadata">

### Author: ![Koinu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/koinu/32/120781_2.png) [@Koinu](https://meta.discourse.org/u/Koinu)
#### Post date: [2016 年 9 月 30 日午後 5:14 UTC](https://meta.discourse.org/t/populating-full-name-with-email-address-if-left-blank-by-sso/50710/3 "2016-09-30T17:14:13Z")

</div>

It doesn’t literally use the entire email, yes, but it does populate something _potentially_ public with information from something that’s definitely non-public, which turns into a privacy diaster any time there’s a failure to check whether full names are supposed to be enabled/exposed.

IMO, even though I dislike this behavior, I’d suggest that simply warning about this in the SSO documentation could be more than enough of a “fix”. (Where it states that a field is optional, clarify that it doesn’t mean that the field in the database is left blank/null, but is instead populated in this way.)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2016 年 10 月 4 日午前 11:02 UTC](https://meta.discourse.org/t/populating-full-name-with-email-address-if-left-blank-by-sso/50710/4 "2016-10-04T11:02:13Z")

</div>

Sure, feel free to edit to clarify.

Not sending username OR name in sso payload is considered highly irregular and this is simply a corner case being handled.

I am also to a PR that requires name or username is always set when sending through sso reqs.

A #pr-welcome for “either name or username must be set, if not sso returns an error”
