# Cannot change username with SSO enabled

**URL:** https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307
**Category:** Bug
**Created:** [7월 22, 2015, 3:17오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307 "2015-07-22T15:17:20Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [7월 22, 2015, 3:17오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/1 "2015-07-22T15:17:20Z")

</div>

When renaming a user (from `jb1` to `jb`), I get this error message:  
`There was an error changing your username.`

No information is recorded in `/logs`.  
The old username was created because the user used SSO for the first time, and his name was too short. Now, I changed the minimum username length, and wanted to adjust his name.

---

<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: [7월 22, 2015, 8:41오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/2 "2015-07-22T20:41:29Z")

</div>

what happens when you rename to jb2 … jx ?

---

<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: [7월 22, 2015, 8:42오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/3 "2015-07-22T20:42:08Z")

</div>

Almost certainly a length restriction. Unlikely to be a bug.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [7월 22, 2015, 8:56오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/4 "2015-07-22T20:56:52Z")

</div>

Is there any setting for length restrictions apart from `min username length`, which I have set to `2`?  
Setting any other name does not work either.

---

<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: [7월 22, 2015, 8:57오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/5 "2015-07-22T20:57:57Z")

</div>

Changing username minimum after the fact (e.g. setting minimum username length to 4 chars, when you have ten users with 2 char usernames) will cause _lots_ of problems.

---

<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: [7월 22, 2015, 8:58오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/6 "2015-07-22T20:58:54Z")

</div>

what happens if you restart your container, maybe something bad is cached?

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [7월 22, 2015, 9:19오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/7 "2015-07-22T21:19:02Z")

</div>

I restarted (or in fact: rebuild) the container, this did not help.

---

<div class="post-metadata">

### Author: ![fefrei](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/fefrei/32/119538_2.png) [@fefrei](https://meta.discourse.org/u/fefrei)
#### Post date: [7월 23, 2015, 8:14오전 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/8 "2015-07-23T08:14:58Z")

</div>

I found it: `sso overrides username` prevents the name change.

I still consider this situation a bug. Enabling this setting should _either_ hide the `Change Username` button from the administrator panel and disable the `users/.../preferences/username` page, _or_ still allow username changes for admins (possibly with a warning).  
I’d prefer the latter, to allow admins to manually “untangle” cases where Discourse’s change-illegal-names-system has created unintended names.

---

<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: [10월 7, 2021, 5:24오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/10 "2021-10-07T17:24:12Z")

</div>

이 PR은 OP에 설명된 문제에 대한 테스트 케이스를 추가하여, 예를 들어 `jb1`에서 `jb`로 사용자 이름(Username)을 오버라이드하는 것이 일반적으로 제대로 동작하는지 확인할 수 있도록 합니다:

> <https://github.com/discourse/discourse/pull/14555>
>
> The problem was \[reported\](https://meta.discourse.org/t/cannot-change-username-w…ith-sso-enabled/31307) a long time ago. It's hard to say if this bag didn't exist or was fixed later, but test cases in this PR prove that this works now.

> [@fefrei](#):
>
> 원인을 찾았습니다: `sso overrides username` 설정이 이름 변경을 방지하고 있습니다.
> 
> 여전히 이 상황을 버그라고 생각합니다. 이 설정을 활성화하면 관리자 패널에서 `Change Username` 버튼을 숨기고 `users/.../preferences/username` 페이지를 비활성화하거나, _또는_ 관리자(Admin)의 경우 경고와 함께 사용자 이름 변경을 계속 허용해야 합니다.

확인해 보겠습니다.

---

<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: [12월 29, 2021, 9:15오후 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/11 "2021-12-29T21:15:10Z")

</div>

> [@fefrei](#):
>
> 발견했습니다: `sso overrides username` 설정이 이름 변경을 막고 있었습니다.
> 
> 여전히 이 상황을 버그라고 생각합니다. 이 설정을 활성화하면 _관리자 패널에서_ `Change Username`(사용자 이름 변경) 버튼을 숨기고 `users/.../preferences/username` 페이지를 비활성화하거나, _아니면_ 관리자가 사용자 이름을 변경할 수 있도록 허용(경고 메시지와 함께)해야 합니다.

결국 이미 수정되어 있었습니다. 해당 설정이 켜져 있을 때 이 연필 아이콘을 숨기도록 했습니다:

 ![Screenshot 2021-12-29 at 22.05.33](https://global.discourse-cdn.com/meta/original/3X/9/6/960cdf8fe2c06dc07cfe54c2564300d783513e29.png)

또한, 관리자가 특정 사용자의 사용자 이름을 변경하려고 할 때 다음과 같은 내용을 표시합니다:

 ![Screenshot 2021-12-29 at 22.11.51](https://global.discourse-cdn.com/meta/original/3X/7/1/71fcbc280e6f9025de5faa8cc165c0597e024555.png)

---

<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: [1월 4, 2022, 7:00오전 UTC](https://meta.discourse.org/t/cannot-change-username-with-sso-enabled/31307/12 "2022-01-04T07:00:19Z")

</div>

이 주제는 5일 후 자동으로 닫혔습니다. 더 이상 새 답변을 남길 수 없습니다.
