# Anonymer Benutzername – über 100 Benutzer

**URL:** https://meta.discourse.org/t/anonymous-username-over-100-users/117817
**Category:** Support
**Created:** [15. Mai 2019 um 15:20 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817 "2019-05-15T15:20:26Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![Jono\_Brain2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jono_brain2/32/106550_2.png) [@Jono\_Brain2](https://meta.discourse.org/u/Jono_Brain2)
#### Post date: [15. Mai 2019 um 15:20 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/1 "2019-05-15T15:20:26Z")

</div>

We have really weird issue, up until user 100 the username was in this format

anonymousxxx  
e.g. anonymous10, anonymous55, anonymous100

However as soon as we reached over number 100 anonymous user accounts, they are now in this format:

9ab9441ad3316f5d2d35cd4807317cc  
01c3b651778b7871a7640511daa8eb8

---

<div class="post-metadata">

### Author: ![Jono\_Brain2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jono_brain2/32/106550_2.png) [@Jono\_Brain2](https://meta.discourse.org/u/Jono_Brain2)
#### Post date: [15. Mai 2019 um 15:33 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/2 "2019-05-15T15:33:02Z")

</div>

Think i can see why looking at this code, but it seems a bit short sighted to only allow 100 random users?

```
def self.find_available_username_based_on(name, allow_username = nil)
    name = fix_username(name)
    i = 1
    attempt = name
    **until attempt == allow_username || User.username_available?(attempt) || i > 100**
      suffix = i.to_s
      max_length = User.username_length.end - suffix.length - 1
      attempt = "#{name[0..max_length]}#{suffix}"
      i += 1
    end
    until attempt == allow_username || User.username_available?(attempt) || i > 200
      attempt = SecureRandom.hex[1..SiteSetting.max_username_length]
      i += 1
    end
    attempt
  end

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [16. Mai 2019 um 04:58 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/3 "2019-05-16T04:58:38Z")

</div>

Is this an actual bug @sam?

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [16. Mai 2019 um 05:13 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/4 "2019-05-16T05:13:27Z")

</div>

Surprisingly not the first time this has been reported:

> [@User\_name\_suggester will become buggy when in non-english version discourse](https://meta.discourse.org/t/user-name-suggester-will-become-buggy-when-in-non-english-version-discourse/107161):
>
> Hi, this is Lisbeth from Taiwan. We use Traditional Chinese version discourse here, and we found this bug when our anonymous username become random hex which looks creepy for friendly users LOL. Our first 100 anonymous username are something like 1111, 1112…111100, after 111100, it will become random hex. So I keep digging the source code, and see that anonymous user name use a user\_name\_suggester.suggest, it will put Anonymous in Chinese (匿名) these two words into the suggester, when it go th…

Think that last report went misunderstood, too.

---

<div class="post-metadata">

### Author: ![lisbethw1130](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lisbethw1130/32/129613_2.png) [@lisbethw1130](https://meta.discourse.org/u/lisbethw1130)
#### Post date: [16. Mai 2019 um 05:51 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/5 "2019-05-16T05:51:43Z")

</div>

yeah, it hasn’t been fixed, so we have to change the name every 99 times 😪

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [16. Mai 2019 um 06:05 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/6 "2019-05-16T06:05:36Z")

</div>

I suggest we fix this @tgxworld

---

<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: [16. Mai 2019 um 07:16 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/7 "2019-05-16T07:16:14Z")

</div>

This is a tricky problem we need a different algorithm here.

Fixed per:

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

---

<div class="post-metadata">

### Author: ![Jono\_Brain2](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jono_brain2/32/106550_2.png) [@Jono\_Brain2](https://meta.discourse.org/u/Jono_Brain2)
#### Post date: [16. Mai 2019 um 07:21 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/8 "2019-05-16T07:21:15Z")

</div>

Thanks guys.

I was going to look at doing a change so when the username is ‘anonymous’ it works slightly different and checks for the last one created. But @sam 's solution seems a lot better.

---

<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: [25. September 2022 um 14:16 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/11 "2022-09-25T14:16:03Z")

</div>



---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [25. September 2022 um 14:21 UTC](https://meta.discourse.org/t/anonymous-username-over-100-users/117817/12 "2022-09-25T14:21:54Z")

</div>


