dsu1/Archivist

Username Validation Not Functioning Properly

Opened this issue · 0 comments

dsu1 commented

While writing tests, I found that the regex for the username length validation was not working.

models/user.rb

Current: /[a-zA-Z0-9]{3,24}/
Solution: /^[a-zA-Z0-9]{3,24}$/

  • This forces the string in between the range because before the regex would take groups when the string exceeded 24 characters
  • Add an error message too stating no white spaces, underscores, or other special characters