# L'erreur n'est pas mise en évidence lorsque le nom d'utilisateur est correct, mais qu'il n'y a pas assez de caractères dans le mot de passe

**URL:** https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505
**Category:** Bug
**Tags:** pr-welcome, ux, signup
**Created:** [Septembre 3, 2025, 11:44 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505 "2025-09-03T23:44:02Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [Septembre 3, 2025, 11:44 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/1 "2025-09-03T23:44:02Z")

</div>

Lors de l’enregistrement d’un nouveau forum, il y a quelques incohérences dans la façon dont Discourse affiche les erreurs lors de l’inscription.

Avec nom d’utilisateur et mot de passe vides :

 ![Screenshot 2025-09-03 at 4.39.14 PM](https://global.discourse-cdn.com/meta/original/4X/3/d/f/3df9363a0565eda6c023df6beab79ce3a588ad2c.png)

Lorsque le nom d’utilisateur est saisi, mais que le champ du mot de passe est vide, une erreur indiquant que le champ ne peut pas être vide est affichée, mais l’entrée n’est pas mise en surbrillance :

 ![Screenshot 2025-09-03 at 4.40.35 PM](https://global.discourse-cdn.com/meta/original/4X/a/7/0/a7017bf186b2d2cc354f1b931ddc71dea5942005.png)

Lors de l’enregistrement avec moins de caractères requis, il n’y a pas de surlignage rouge ni d’erreurs :

 ![Screenshot 2025-09-03 at 4.37.50 PM](https://global.discourse-cdn.com/meta/original/4X/1/f/9/1f92c7f200195e0b8a2965f478c362ceaa67d0bf.png)

---

<div class="post-metadata">

### Author: ![arun](https://avatars.discourse-cdn.com/v4/letter/a/ee7513/32.png) [@arun](https://meta.discourse.org/u/arun)
#### Post date: [Septembre 7, 2025, 5:12 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/2 "2025-09-07T17:12:21Z")

</div>

Pour que je comprenne mieux, cela fait-il référence à la création d’un utilisateur sur un forum ou à une inscription différente ? Je vois un écran différent lors de la création d’un utilisateur :

 ![image](https://global.discourse-cdn.com/meta/original/4X/9/c/7/9c74e25bbd98f448ba97892a1e44c617d995caf5.png)

---

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [Septembre 15, 2025, 4:06 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/4 "2025-09-15T16:06:16Z")

</div>

Ceci est l’écran de création du compte administrateur initial, qui est légèrement différent du formulaire d’inscription normal.

---

<div class="post-metadata">

### Author: ![asa](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/asa/32/184869_2.png) [@asa](https://meta.discourse.org/u/asa)
#### Post date: [Septembre 15, 2025, 4:21 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/5 "2025-09-15T16:21:11Z")

</div>

J’ai eu le même problème il y a 3 semaines lors de la création de mes comptes administrateur. J’avais choisi un mot de passe de moins de 15 caractères, mais il n’y a eu aucun message d’erreur, j’ai dû chercher un peu. Après avoir choisi un mot de passe plus long, le compte a été créé.

---

<div class="post-metadata">

### Author: ![lindsey](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lindsey/32/318210_2.png) [@lindsey](https://meta.discourse.org/u/lindsey)
#### Post date: [Septembre 16, 2025, 5:12 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/6 "2025-09-16T17:12:27Z")

</div>

@featheredtoast J’essaie de reproduire cela et j’ai quelques difficultés.

Lorsque j’ai lancé un nouveau site d’essai, je n’ai pu reproduire aucune de ces erreurs.

- Aucune erreur ne s’affiche lorsque le nom d’utilisateur / mot de passe est vide ; le bouton Continuer est désactivé.
- Aucune erreur ne s’affiche lorsque le nom d’utilisateur est entré et le mot de passe est vide ; même chose que ci-dessus — le bouton Continuer reste désactivé.
- Je vois une erreur informative lorsque mon mot de passe est trop court.

 ![CleanShot 2025-09-16 at 13.11.37](https://global.discourse-cdn.com/meta/original/4X/0/c/7/0c7ea961825a4622ec142d081e4d03fc184efb83.png)

Ceci est juste un nouvel essai via la page `/pricing`. Où voyez-vous vos erreurs ?

---

<div class="post-metadata">

### Author: ![featheredtoast](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/featheredtoast/32/116994_2.png) [@featheredtoast](https://meta.discourse.org/u/featheredtoast)
#### Post date: [Septembre 16, 2025, 6:13 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/7 "2025-09-16T18:13:48Z")

</div>

Désolé si ce n’est pas clair - c’est l’inscription initiale donnée à une inscription d’administrateur, je crois que ce n’est disponible que sur un site auto-hébergé, pas sur un site hébergé par Discourse.

Il y a un formulaire d’inscription complètement séparé après avoir reçu le message « Félicitations, vous avez installé Discourse », voici une capture d’écran complète de la page d’inscription en question :

 ![Screenshot 2025-09-16 at 11.12.54 AM](https://global.discourse-cdn.com/meta/original/4X/2/5/f/25feb5dee02d23f7b29e88a8b789f17902fc430c.png)

---

<div class="post-metadata">

### Author: ![chapoi](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/chapoi/32/537252_2.png) [@chapoi](https://meta.discourse.org/u/chapoi)
#### Post date: [Décembre 12, 2025, 8:51 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/9 "2025-12-12T08:51:56Z")

</div>

Nous venons de recevoir quelques mentions supplémentaires de ce problème :

> [@关于我安装discourse之后，打开网页点击注册没有任何反应](https://meta.discourse.org/t/discourse/390912):
>
> 我今天按照官方的方式进行安装discourse论坛 我的系统是ubuntu24的版本 安装完成后打开我的网站开始注册管理员账户，但是点击注册时没有任何反应，并且点击F12之后没有发现错误 现在就是一直卡在这个页面上

> [@I'm stuck on the "Register Administrator Account" page and can't register](https://meta.discourse.org/t/im-stuck-on-the-register-administrator-account-page-and-cant-register/388638):
>
> I have checked containers/app.yml and installed it. The doctor command ran without any errors, and the email connection is normal. However, I am stuck on the ‘Register Admin Account’ page and cannot proceed to the next step. The page refreshes immediately after clicking the ‘Register’ button. Why is this happening? Is it related to my configuration file ‘app.yml’?

> [@Optimization Proposal for Discourse Admin Account Registration Process](https://meta.discourse.org/t/optimization-proposal-for-discourse-admin-account-registration-process/391119):
>
> Background Yesterday, I self-hosted a Discourse instance on my server. After the deployment was complete, I proceeded to register the administrator (admin) account. However, after clicking the Register button, there was no response, and the process seemed to hang. It took me a significant amount of time to realize that the issue was due to my password not meeting the minimum character length requirement. Existing Solution & Observation I must admit that I did see the official, friendly reminde…

Je les rassemble ici.

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [Décembre 12, 2025, 9:23 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/11 "2025-12-12T21:23:06Z")

</div>

Sera corrigé par

> <https://github.com/discourse/discourse/pull/36672>
>
> When submitting the admin registration form with an invalid password (blank or t…oo short), the password field was not visually highlighted with the error state, making it unclear what was wrong.
> 
> Two issues were causing this:
> 
> 1. Copy-paste error: The password field container was checking \`@user.errors\[:username\]\` instead of \`@user.errors\[:password\]\`
> 
> 2. Wrong error key: Password length validation errors from the UserPassword model are stored under \`:"user\_password.password"\`, not \`:password\`. The template only checked the latter.
> 
> Fixed by checking both error keys and displaying all password-related errors with proper visual highlighting.
> 
> Added system spec with page object for UI behavior testing and trimmed request spec to cover edge cases that require stubs (like empty developer\_emails).
> 
> Ref - https://meta.discourse.org/t/381505
> 
> Here's how the errors look like
> 
> \*\*Blank username & blank password\*\*
> \<img width="1772" height="1274" alt="CleanShot 2025-12-12 at 22 01 03" src="https://github.com/user-attachments/assets/4a6a3628-7a9b-48ee-bf9e-f6b1baba9b90" /\>
> 
> \*\*Username filled & blank password\*\*
> \<img width="1772" height="1274" alt="CleanShot 2025-12-12 at 22 01 18" src="https://github.com/user-attachments/assets/fdef8ad1-1aa9-4b12-90d8-aeccc8344fc0" /\>
> 
> \*\*Username filled & short password\*\*
> \<img width="1772" height="1274" alt="CleanShot 2025-12-12 at 22 01 29" src="https://github.com/user-attachments/assets/2c1c96e4-e5d4-40af-8f33-30ca0e1aafc5" /\>

J’ai pris le temps d’augmenter la couverture en ajoutant également une spécification système 👍

---

<div class="post-metadata">

### Author: ![zogstrip](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/zogstrip/32/512781_2.png) [@zogstrip](https://meta.discourse.org/u/zogstrip)
#### Post date: [Décembre 13, 2025, 9:44 UTC](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505/12 "2025-12-13T21:44:14Z")

</div>


