# Erro não é destacado quando o nome de usuário está correto, mas a senha não tem caracteres suficientes

**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:** [3 Setembro , 2025 23: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:** 1\
**Showing post:** 11

<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:** [12 Dezembro , 2025 21: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>

Será corrigido por

> <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" /\>

Aproveitei para aumentar a cobertura adicionando também uma especificação de sistema 👍

---

_[View the full topic](https://meta.discourse.org/t/error-is-not-highlighted-when-username-is-correct-but-not-enough-characters-in-password/381505)._
