-
Notifications
You must be signed in to change notification settings - Fork 4
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
add frontend validation for alphanumeric usernames and passwords #1537
base: dev
Are you sure you want to change the base?
Conversation
@calebeby I don't know exactly the purpose of the |
Alphanumeric is only a-z, A-Z, and 0-9. So yeah, the backend will not allow underscores in usernames. I tested it too to double check: I do not mind if you change it to allow underscores, but you'd need to update the backend code. |
@varCepheid Not sure your background with automated software testing, let me know if you want a more detailed description, otherwise I'll start with this:
In this case, the test I wrote types out a username that has a space in it. I assume your code changes in this PR prevent the form from submitting if there is a space. So the automated test noticed that the fetch request is no longer going through when "log in" is clicked. You can fix the test by changing the username that it types in to be alphanumeric. Even better, you can add a test case for your changes in this PR that check that if you try to submit the form with non-alphanumeric characters in username, it doesn't submit the form and instead displays a helpful error message! |
I'm not super familiar with automated testing. The code is pretty human-readable, which helps, but despite making what seemed like an appropriate change, the test check is still failing. I added the second test to confirm that the error alert is working, but the test check told me that it couldn't find an element with the alert's text, even though that's definitely the text that the alert contains. Maybe I'm understanding something wrong? |
- allowed passwords to have special characters (the backend handles them fine) - made progress on new test for new alert
I played around a bunch with the tests and couldn't quite get them to work. The documentation for |
I didn't fix the problem; I just removed the code that was causing it to fail. The new test doesn't currently check anything. I can't figure out what is unique to an invalid username that the test is able to find, given that the |
closes #1528
This PR creates an alert on the login and signup pages that will be thrown if the user submits the form with non-alphanum characters in the username or password, except for underscores.