Some common restrictions are: Leaving the last requirement for now, as it requires a server-side script, let's see what's possible using just client-side HTML and Java Script.While having a strong password is a good first step, it needs to be backed up by additional measures on the server that prevent brute-force attacks.Remember that, as Java Script isn't available in all browsers, you should also use server-side scripting to validate all data before recording it in a database or elsewhere.

regular expression for validating email address-79

For security a password should never be displayed in HTML or sent by email.

If you're concerned about security you should have some policy on what constitutes a valid password.

If the purpose of registration is to confirm that the person exists, and that they have supplied a valid email address, then as part of the registration processe you a should either email them a random password or a confirmation token rather than letting them choose their own password and use it immediately.

The code presented below would then be used for letting the user change their password.


You might implement this code on your own website as follows: As you can see, it's well worth learning the intricacies of regular expressions.

The form below has three input fields: username, pwd1 and pwd2. If a false value is returned then the form submission is cancelled.

This code will work for browsers as far back as Netscape 4 (circa 1997). If you're not sure how to place this on your page, you might need to read the preceding article on Form Validation, or view the HTML source of this page.

A lot of websites now require registration, meaning that users need to be assigned a username and password.