-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.js
More file actions
33 lines (26 loc) · 883 Bytes
/
Copy pathvalidation.js
File metadata and controls
33 lines (26 loc) · 883 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
function validatePassword() {
password = document.getElementById('password').value;
retypePassword = document.getElementById('retypePassword').value;
phone = document.getElementById('phone').value;
if (phone.length !== 10) {
alert("phone number should be of 10 numbers length.");
return false;
}
if (password.length < 8) {
alert("Password must be at least 8 characters long.");
return false;
}
if (!/[A-Z]/.test(password)) {
alert("Password must contain at least one capital letter.");
return false;
}
if (!/[!@#$%^&*(),.?":{}|<>0-9]/.test(password)) {
alert("Password must contain at least one special symbol or integer");
return false;
}
if (password !== retypePassword) {
alert("Passwords do not match.");
return false;
}
return true;
}