Skip to content
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

sign up issues if user enters enter multiple spaces in first name #2358 #119

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

<!-- MagicCodeVerificationPage (OTP)
OTP verification page for authenticating with a magic code -->
<Route path="/verify-magic-code/:id" component={VerifyMagicCode} />
<Route path="/verify-magic-code/:id/:name" component={VerifyMagicCode} />

<!-- EmailEntryPage
Page where the user enters their email, redirecting to login or registration based on context -->
Expand Down
7 changes: 6 additions & 1 deletion src/lib/utils/validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as yup from 'yup';
const emailRegex = /^([a-zA-Z0-9._%-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]+)$/;
const firstNameRegex = /^[A-Za-z\s]+$/;
const lastNameRegex = /^[A-Za-z\s]*$/;
const firstNameSpaceCheck = /^[^\s].*$/;

//----------------------------- Check Validation ---------------------//
export const checkValidation = async (validationSchema, val) => {
Expand All @@ -25,7 +26,11 @@ export const registrationSchema = yup.object().shape({
.email()
.matches(emailRegex, 'Please enter a valid Email ID')
.required('Please enter a valid Email ID'),
firstName: yup.string().trim().matches(firstNameRegex, "Your first name cannot have numbers or special characters.").required('Please enter your first name.'),
firstName:yup
.string()
.matches(firstNameRegex, "Your first name cannot have numbers or special characters.")
.matches(firstNameSpaceCheck , 'Your first name cannot start with spaces.')
.required('Please enter your first name.'),
lastName: yup.string().matches(lastNameRegex, "Your last name cannot have numbers or special characters."),
password: yup
.string()
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Auth/entry-point/EntryPoint.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
try {
const magicCodeResponse = await sendMagicCodeEmail({ email });
if (magicCodeResponse.isSuccessful) {
navigate(`/verify-magic-code/${email}`); // Updated this line
navigate(`/verify-magic-code/${email}/${magicCodeResponse.data}`); // Updated this line
Copy link
Member

Choose a reason for hiding this comment

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

why we have this changes in this PR also, i think you have already raised a PR for this.

} else {
if (magicCodeResponse?.message === 'Cooldown Active') {
navigate('/cool-down-active');
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Auth/login-page/LoginPage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
</div>

{#if validationErrors?.password && isPasswordTouched}
<small class="form-text text-dangerColor">{validationErrors?.password}</small>
<small class="form-text text-dangerColor ">{validationErrors?.password}</small>
{:else if authenticationError}
<small class="form-text text-dangerColor"
>The email and password combination you entered appears to be incorrect. Please try
Expand Down
Loading