Skip to content

Conversation

@codefiles
Copy link
Contributor

Fixes #3532

@codefiles codefiles requested a review from Torxed as a code owner May 28, 2025 23:47
case _:
raise ValueError('Unhandled result type')

if not username:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like _check_for_correct_username is supposed to ensure that the username starts with a lowercase letter or underscore (but it's not doing so).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can trigger the message The username you entered is invalid to appear below the input field by starting a username without a lowercase letter or underscore. I am not sure why it is not working for you.

Seems like skip would be the intended outcome when pressing enter at an empty input field.

Copy link
Contributor Author

@codefiles codefiles May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean, why is an empty string not triggering the validator? The validator will not be used when text is an empty string.

if text and self._validator:
if (err := self._validator(text)) is not None:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes, that was the confusing part. I assumed the validator function would run on all inputs :).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An empty string is essentially no input, so there is nothing to validate. Makes sense to me anyway.

@svartkanin svartkanin merged commit 7316b56 into archlinux:master May 29, 2025
9 checks passed
@codefiles codefiles deleted the fix-empty-username branch May 29, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Empty usernames are allowed when creating user accounts

3 participants