-
Notifications
You must be signed in to change notification settings - Fork 271
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
chore(clerk-js): Allow single-character usernames in <UserProfile />
validation
#4243
chore(clerk-js): Allow single-character usernames in <UserProfile />
validation
#4243
Conversation
🦋 Changeset detectedLatest commit: 772f2a4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -26,8 +26,7 @@ export const UsernameForm = withCardStateProvider((props: UsernameFormProps) => | |||
|
|||
const isUsernameRequired = userSettings.attributes.username.required; | |||
|
|||
const canSubmit = | |||
(isUsernameRequired ? usernameField.value.length > 1 : true) && user.username !== usernameField.value; | |||
const canSubmit = user.username !== usernameField.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ It seems like we have the userSettings available and thus the username min and max length. Is it possible to use them on the client side validation in place of the hardcoded value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikospapcom I don't see why this change improves things.
Currently we want to disable the button, and don't let you submit if you don't have a value in the field or the value that you matches your current username.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe only changing usernameField.value.length > 0
is enough ?
@@ -26,8 +26,7 @@ export const UsernameForm = withCardStateProvider((props: UsernameFormProps) => | |||
|
|||
const isUsernameRequired = userSettings.attributes.username.required; | |||
|
|||
const canSubmit = | |||
(isUsernameRequired ? usernameField.value.length > 1 : true) && user.username !== usernameField.value; | |||
const canSubmit = user.username !== usernameField.value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nikospapcom I don't see why this change improves things.
Currently we want to disable the button, and don't let you submit if you don't have a value in the field or the value that you matches your current username.
670d0c5
to
772f2a4
Compare
<UserProfile />
username field<UserProfile />
validation
Description
In this pr we are allowing single-character usernames in
<UserProfile />
validationChecklist
npm test
runs as expected.npm run build
runs as expected.Type of change