-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path14.change_pass.php
129 lines (118 loc) · 4.01 KB
/
14.change_pass.php
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<html>
<head>
<title>change password</title>
<style>
body{
margin:0px;
padding:0px;
font-family: monospace;
background: linear-gradient(120deg,#2980b9,#8e44ad);
overflow: hiddden;
}
.center{
position: absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
width: 400px;
height:320px;
background: white;
border-radius: 10px;
}
.center h1{
text-align: center;
padding: 0 0 20px 0;
border-bottom: 1px solid silver;
}
.center form{
padding: 0 40px;
box-sizing: border-box;
}
form .txt_field{
position: relative;
margin:50px 0;
}
.txt_field input{
margin-left: 70px;
padding:10px;
border:1px solid black;
border-radius:5px;
}
.sub button{
margin-left: 120px;
padding: 8px;
margin-top: -20px;
width:70px;
border:1px solid black;
border-radius:5px;
}
.signin-btn
{
margin-left: 120px;
padding: 8px;
margin-top: -20px;
width:70px;
border:1px solid black;
border-radius:5px;
}
</style>
</head>
<body>
<div class="center">
<h1>Change Password</h1>
<form id="form" method="POST" action="14.1.change_pass_code.php">
<div class="txt_field">
<input type="password" id="text1" name="pass" required placeholder="New Password"><br><br>
<input type="password" id="text2" name="cpass" required placeholder="Confirm Password">
</div>
<div class="sub">
<button type="submit" id="register" name="register">Submit</button>
<!--<input class="signin-btn" type="submit" id="register" name="register" value="Submit">-->
</div>
</form>
</div>
<script>
document.getElementById("register").addEventListener("click", function(e)
{
e.preventDefault();
var pass=document.getElementById("text1").value;
var cpass=document.getElementById("text2").value;
var pass_status=0,cpass_status=0;
var msg="";
var regx=/^[a-zA-Z0-9@#$*\.]{8,30}$/;
if(pass.length < 8)
{
msg+=" Password length should be greater than or qeual to 8 charcaters\n";
}
else
{
if(regx.test(pass))
{
if(cpass == pass)
{
pass_status=1;
cpass_status=1;
}
else
{
msg+="Password and confirm password are not same\n";
}
}
else
{
msg+="Password must contain letters, numbers, special characters(@,#,$,*,.)\n";
}
}
if( pass_status == 1 && cpass_status == 1)
{
alert("Updating Details");
document.getElementById("form").submit();
}
else
{
alert(msg);
}
});
</script>
</body>
</html>