Add more verification to sign up
This commit is contained in:
@@ -35,6 +35,13 @@ const LoginModal = ({ open, onClose, shouldStartWithSignup = false }) => {
|
||||
if (checkBox) {
|
||||
subscribe({ email, addMessage: (msg) => toast.error(msg), name })
|
||||
}
|
||||
const { isUserNameAvailable } = await fetch(
|
||||
`/.netlify/functions/check-user-name?username=${userName}`
|
||||
).then((res) => res.json())
|
||||
if (!isUserNameAvailable) {
|
||||
setError('UserName is already taken, please try something else')
|
||||
return
|
||||
}
|
||||
await signUp({
|
||||
email,
|
||||
password,
|
||||
@@ -167,6 +174,10 @@ const SignUpForm = ({ onSubmitSignUp, checkBox, setCheckBox, onClose }) => (
|
||||
value: /^[a-zA-Z0-9-_]+$/,
|
||||
message: 'Only alphanumeric and dash characters allowed',
|
||||
},
|
||||
minLength: {
|
||||
value: 5,
|
||||
message: 'Not enough Characters',
|
||||
},
|
||||
}}
|
||||
/>
|
||||
<Field
|
||||
|
||||
Reference in New Issue
Block a user