Skip to content

Bug: FE presents undetailed error message for username validation #1693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
greyscaled opened this issue May 23, 2022 · 2 comments · Fixed by #1851
Closed

Bug: FE presents undetailed error message for username validation #1693

greyscaled opened this issue May 23, 2022 · 2 comments · Fixed by #1851
Assignees
Labels
site Area: frontend dashboard
Milestone

Comments

@greyscaled
Copy link
Contributor

greyscaled commented May 23, 2022

This is a spawn-off of #1689 (thanks @oxy 🎉)

Steps to Reproduce

See #1689

Expected

A helpful error message regarding what letters/characters/combinations the username accepts

Actual

An undetailed error message

Screenshot

169904635-8063880a-6d28-45b1-836c-cce8ce82bc48

Notes

The Yup validation needs improvements here:

This uses username validation, which is a custom validator we have in our backend.

To source this, see that the struct has a username tag here:

Username string `json:"username" validate:"required,username"`

Which is defined here:

err := validate.RegisterValidation("username", func(fl validator.FieldLevel) bool {
f := fl.Field().Interface()
str, ok := f.(string)
if !ok {
return false
}
if len(str) > 32 {
return false
}
if len(str) < 1 {
return false
}
return usernameRegex.MatchString(str)
})

usernameRegex = regexp.MustCompile("^[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*$")

@greyscaled greyscaled added bug 🐛 site Area: frontend dashboard labels May 23, 2022
@greyscaled
Copy link
Contributor Author

Please add your planning poker estimate with ZenHub @Kira-Pilot

@greyscaled
Copy link
Contributor Author

Further note:

The implementation to this FE is identical to #1453 but applied to a user's username with different product copy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
site Area: frontend dashboard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants