# Generic “userN” usernames

**URL:** https://meta.discourse.org/t/generic-usern-usernames/207237
**Category:** Support
**Created:** [October 27, 2021, 10:48am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237 "2021-10-27T10:48:36Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![kevinherron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinherron/32/237994_2.png) [@kevinherron](https://meta.discourse.org/u/kevinherron)
#### Post date: [October 27, 2021, 10:48am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/1 "2021-10-27T10:48:36Z")

</div>

Was there a recent change that is leading to the influx of generic users named “userN” (where N is some number) on our Discourse instance and if so it possible to disable this? I haven’t been able to find anything in the settings.

---

<div class="post-metadata">

### Author: ![anon73664359](https://avatars.discourse-cdn.com/v4/letter/a/6de8d8/32.png) [@anon73664359](https://meta.discourse.org/u/anon73664359)
#### Post date: [October 27, 2021, 11:01am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/2 "2021-10-27T11:01:52Z")

</div>

Those accounts might’ve been anonymized at some point in time.

> [@Anonymizing Users in Discourse](https://meta.discourse.org/t/anonymizing-users-in-discourse/86929):
>
> If you want to permanently remove a user from your community, but also preserve their contributions to Discourse, you can anonymize that user. How do I anonymize a user? At the bottom of a user’s admin page, there is an “Anonymize User” button: You’ll be asked to confirm. If you agree, the user will be anonymized. How thorough is the anonymization? The user will no longer be able to log in to your community as this specific account. A new username will be randomly assigned to t…

---

<div class="post-metadata">

### Author: ![kevinherron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinherron/32/237994_2.png) [@kevinherron](https://meta.discourse.org/u/kevinherron)
#### Post date: [October 27, 2021, 11:06am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/3 "2021-10-27T11:06:53Z")

</div>

They’re all new users asking their first question, I don’t think they’ve been anonymized by an admin.

Edit: or just new users, not necessarily with a post.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [October 27, 2021, 11:21am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/4 "2021-10-27T11:21:55Z")

</div>

What method are these new users using to sign-up?

---

<div class="post-metadata">

### Author: ![kevinherron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinherron/32/237994_2.png) [@kevinherron](https://meta.discourse.org/u/kevinherron)
#### Post date: [October 27, 2021, 11:29am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/5 "2021-10-27T11:29:13Z")

</div>

I’m not sure, is there somewhere I can check that?

It seems all these users have empty username details in the [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) SSO section at the bottom of the User Admin page, if that means anything.

 ![image](https://global.discourse-cdn.com/meta/original/3X/4/d/4dc7dacd83cdeff66ac7c689e06a1054b227f251.jpeg)

---

<div class="post-metadata">

### Author: ![Johani](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/johani/32/176920_2.png) [@Johani](https://meta.discourse.org/u/Johani)
#### Post date: [October 27, 2021, 11:30am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/6 "2021-10-27T11:30:53Z")

</div>

Do you have groups with the same names?

This sounds similar to

> [@Username changed after Discourse upgrade](https://meta.discourse.org/t/username-changed-after-discourse-upgrade/92099/2):
>
> There is likely a group with the name martin. Users and groups cannot share the same name. There was previously a bug which allowed this to happen, but it has now been fixed - that’s why your username has been changed automatically. We should probably update the error message here to make it clear that a username must not match any group names. Added to my list to investigate

---

<div class="post-metadata">

### Author: ![kevinherron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinherron/32/237994_2.png) [@kevinherron](https://meta.discourse.org/u/kevinherron)
#### Post date: [October 27, 2021, 11:34am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/7 "2021-10-27T11:34:27Z")

</div>

There is no group called “user”.

---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [October 27, 2021, 11:48am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/8 "2021-10-27T11:48:13Z")

</div>

> [@kevinherron](#):
>
> It seems all these users have empty username details in the [DiscourseConnect](https://meta.discourse.org/t/13045) SSO section at the bottom of the User Admin page, if that means anything.

Can you check your [discourse connect](https://meta.discourse.org/t/13045?silent=true) sign-up and see if the username field can be skipped when registering?

---

<div class="post-metadata">

### Author: ![kevinherron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinherron/32/237994_2.png) [@kevinherron](https://meta.discourse.org/u/kevinherron)
#### Post date: [October 27, 2021, 11:53am UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/9 "2021-10-27T11:53:17Z")

</div>

I’ll have to check with the internal systems team that manages our global user accounts and I assume the integration with [Discourse Connect](https://meta.discourse.org/t/13045?silent=true) SSO. I suspect the issue is somewhere in here… just not sure why the sudden behavior change. I don’t think our global accounts have usernames, just emails, but this issue seems to have just popped up.

Anyway it’ll be a few hours before anybody is actually online. I’m up waaaay early.

---

<div class="post-metadata">

### Author: ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)
#### Post date: [October 27, 2021, 12:33pm UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/10 "2021-10-27T12:33:27Z")

</div>

We recently stopped using email addresses when generating usernames during SSO.

[https://github.com/discourse/discourse/commit/88ecb83382e4dc5cec1d9599619a6c40a07825ae](https://github.com/discourse/discourse/commit/88ecb83382e4dc5cec1d9599619a6c40a07825ae)

The recommended solution is to supply a username in the SSO payload. You can go back to the previous behaviour by changing a hidden site setting, but we might remove it in the future.

```plaintext
./launcher enter app
rails c
SiteSetting.use_email_for_username_and_name_suggestions = true

```

---

<div class="post-metadata">

### Author: ![kevinherron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinherron/32/237994_2.png) [@kevinherron](https://meta.discourse.org/u/kevinherron)
#### Post date: [October 27, 2021, 1:25pm UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/11 "2021-10-27T13:25:16Z")

</div>

So if our user accounts don’t have usernames and we just supply the email address in the `username` field of the SSO payload it will behave as it did previously?

---

<div class="post-metadata">

### Author: ![andrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrei/32/205142_2.png) [@andrei](https://meta.discourse.org/u/andrei)
#### Post date: [October 27, 2021, 2:18pm UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/12 "2021-10-27T14:18:56Z")

</div>

> [@kevinherron](#):
>
> So if our user accounts don’t have usernames and we just supply the email address in the `username` field of the SSO payload it will behave as it did previously?

Yes, that should work. But it’s better to avoid generating usernames from emails because in this case, it’s easy to figure out emails of your users. This is insecure.

Note, that you can also send a full name in the **name** field to SSO. If you do so:

- **name** will become the full name of a user on your Discourse
- **name** will be used by SSO for generating username

---

<div class="post-metadata">

### Author: ![kevinherron](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kevinherron/32/237994_2.png) [@kevinherron](https://meta.discourse.org/u/kevinherron)
#### Post date: [October 27, 2021, 4:39pm UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/13 "2021-10-27T16:39:56Z")

</div>

Thanks everybody, I think we’ve got all the info we need to work around this in the short term and fix in the long term.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [November 26, 2021, 4:39pm UTC](https://meta.discourse.org/t/generic-usern-usernames/207237/14 "2021-11-26T16:39:58Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
