jenkoian / hacktoberfest-checker

🎃 Check how you're doing in hacktoberfest
https://hacktoberfestchecker.jenko.me
MIT License
761 stars 363 forks source link

bugfix: remove whitespaces from username input field #711

Closed vimode closed 2 years ago

vimode commented 2 years ago

Possible solution to fix #709

Do you think this solution is a little user hostile? Would it be better to apply the trim() method only onSubmit to all the usages of state username thereafter?

Thank you.

jenkoian commented 2 years ago

Oh you mean because this means you can't enter spaces at all...hmm yeah I think onSubmit would be nicer if easy enough? Don't think it's too bad though if it is hard.

vimode commented 2 years ago

I agree it isn't very bad as spaces aren't a valid character in usernames on either of the websites. It just feels a little aggressive 😄

Let me try a few things. 🤔

I will get back to you as soon as I try these possible solutions, in the meantime if you have other ideas or suggestions or advice or tips I am open to all of those 😃

vimode commented 2 years ago

So the regex replace works the same as trim() if used with onChange.

So I used the trim while passing the state username as an argument in the onSubmit function. Everything should work fine. 🤞

jenkoian commented 2 years ago

Thanks @vimode