inclinedadarsh / timeloom

Document your technical journey on the activity timeline-style page and showcase it to the world!
https://timeloom.vercel.app
MIT License
15 stars 3 forks source link

[BUG] Username with Numbers or Underscores not allowed #14

Closed prakhartiwari0 closed 9 months ago

prakhartiwari0 commented 9 months ago

Describe the bug The username text input does not allow a username with numbers, or special characters.

To Reproduce Steps to reproduce the behaviour:

  1. Go to https://timeloom.vercel.app/signup
  2. Fill the details
  3. Fill a username containing a number or underscore
  4. See the error for username

Expected behaviour It should allow usernames containing numbers (sure about this) and _ (underscore, unsure).

Screenshots Number not allowed Underscore not allowed
image image

Additional context I checked for the availability of the username and it showed that it was available, but when I created an account, it didn't allow that. So things seem to be out of sync.

inclinedadarsh commented 9 months ago

This makes sense. Username should allow numbers, fullstops and underscore.

2 things should be changed I believe:

  1. ZOD validation in the forms. This is the most important as this prevention of using numbers and underscores comes from there only.

  2. Add more strictness in checking the username and stop allowing checking of usernames containing special characters (except fullstops and underscores)

Both of these should be fairly simple. If anyone wants to take this issue, feel free to comment. If you need any help, I'm always up for assistance.

prakhartiwari0 commented 9 months ago

Thanks for providing this information @inclinedadarsh, I do not have the required knowledge currently so, unfortunately, I can't work on this issue. But if anybody is reading this and you can solve this issue, please go ahead and get assigned!

Happy Contributing <3

Jiya55 commented 9 months ago

I could help, but i have more experience in working with python and django. could i still be of some help for this issue?

prakhartiwari0 commented 9 months ago

I could help, but i have more experience in working with python and django. could i still be of some help for this issue?

I guess this issue requires knowledge of Typescript and Next JS.

inclinedadarsh commented 9 months ago

@Jiya55 This does require a bit of JavaScript (and typescript). But I believe if you know a bit of MERN development (even without typescript knowledge) then you can do it.

If you still want to work on this, try checking out file https://github.com/inclinedadarsh/timeloom/blob/main/app/signup/page.tsx (at line 49 to 52 specifically) and see if you understand that. If you do, lemme know and I'll assign this issue to you.

Thank you for showing your interest either way!

jaas666 commented 9 months ago

I can help with this one if needed.

Jiya55 commented 9 months ago

@inclinedadarsh I kind of understood a bit, as i do know how regex works, I can try to help. If we remove the regex which doesn't allow numbers and underscores, then the issue should be fixed right?

jaas666 commented 9 months ago

@Jiya55 you are close. If you completely remove the regex then we lose the current validation. As I understand the issue, what we want is to add underscores, numbers and full stops to the current validation.

I'm not good with regex but this site always help me better understand them: https://regexr.com

Jiya55 commented 9 months ago

i guess i framed it wrong, i meant that if we remove that bit of the regex, which doesnt allow numbers, underscore and full stops.

inclinedadarsh commented 9 months ago

Yes, this is correct @Jiya55 Just one more thing, a user should not be allowed to start their username from fullstops (because that makes sense to me, however if you have a counter point, I'm more than happy to hear)

Use chatgpt to generate the new regex which has these constraints and then test it using the website suggested by @jaas666

Then you can replace it in the code. If possible, connect a local database and then check if it's working just as fine (this is optional though)

Also, it'd be great if you could check some other places if I have used some validation, such as in the api/ directory of signup, etc.

Should I assign this to you @Jiya55 ?

Jiya55 commented 9 months ago

yeah I can try to do it, but it might take some time as i am working on a few personal projects and also need to study but i ll try to do it by this week

rishabraghav commented 9 months ago

@inclinedadarsh assign this issue to me. I completely understood the code. I have to remove the regex or change it in something like the username should not be start with a fullstop.

Jiya55 commented 9 months ago

@inclinedadarsh i have found the regex which works to allow the user to have a username with numbers and underscores and full stops, and the full stop should not be in the start.

inclinedadarsh commented 9 months ago

@rishabraghav I like your PR, but you should always wait for the issue to be assigned to you (unless specified otherwise). For now, I'll have to keep it on waitlist without merging it as @Jiya55 has been following this for so long.

@Jiya55 would you like to work on this? If yes, I'll assign this to you, otherwise I'll accept @rishabraghav's PR.

Jiya55 commented 9 months ago

well the other person has already made the working code and understands the tech stack also well, so you can accept the PR, as it might take me time to understand and do the same thing