FormsLesson 143Free preview
Password Validation
This lesson is part of How To · All levels
Summary
This lesson shows you how to check the password strength on the client side before a form is sent. The examination usually includes minimum length, capital letters, lower case letters, numbers, special characters, and the matching of the confirmation column. Clear feedback helps users fix errors, but validation still has to be repeated on the server because JavaScript can be passed.
Key points
- Use regular expressions to check character categories such as /[A-Z]/ and /[0-9]/
- Compare the password and confirm with the operator === after taking the value
- Display specific error messages and connect to the input via aria-describedby
- Validation of the client is for convenience only; the server is obliged to revalidate all data
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.