Skip to content
This repository has been archived by the owner on Sep 10, 2024. It is now read-only.

Usernames on registration which fail policies cause conflicting error messages #3132

Open
MTRNord opened this issue Aug 22, 2024 · 2 comments

Comments

@MTRNord
Copy link
Contributor

MTRNord commented Aug 22, 2024

grafik

Ideally it only should show the policy error here since the user was not taken in fact. This feels misleading :)

@MTRNord
Copy link
Contributor Author

MTRNord commented Aug 22, 2024

It seems that

} else if !homeserver.is_localpart_available(&form.username).await? {
// The user already exists on the homeserver
// XXX: we may want to return different errors like "this username is reserved"
tracing::warn!(
username = &form.username,
"User tried to register with a reserved username"
);
state.add_error_on_field(RegisterFormField::Username, FieldError::Exists);
}
is an insufficient check or at least the error returned on the UI isnt granular enough.

Specifically the if case at

} if homeserver_error.errcode() == Some(M_INVALID_USERNAME)
|| homeserver_error.errcode() == Some(M_USER_IN_USE) =>
{
debug!("Username not available: {homeserver_error}");
Ok(false)
}
probably is the origin of this as it generalizes

@matrixbot
Copy link
Member

For your information, this issue has been copied over to the Element fork of matrix-authentication-service: element-hq/matrix-authentication-service#3132

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants