-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathforgot.js
37 lines (37 loc) · 943 Bytes
/
forgot.js
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
34
35
36
37
function valid()
{
var answer=document.getElementById('ans').value;
if(answer=="")
{
alert('please enter the security answer');
}
var p = document.getElementById('np').value;
var p1= document.getElementById('np1').value;
if(p=="")
{
alert("password can't be empty");
return false;
}
if(p.length<5||p.length>20)
{
alert("password must be between the length 5-20");
return false;
}
var reg=/^[a-zA-z]+[0-9]+$/;
if(!reg.test(p))
{
alert("password must contain alphabets,digits and special symbols");
return false;
}
if(!p1.match(p))
{
alert("passwords do not match");
return false;
}
var cnf=confirm("Are you sure you want to change your password?");
if(cnf)
return true;
else
return false;
return true;
}