-
Notifications
You must be signed in to change notification settings - Fork 0
/
WT_P10_Signup.htm
221 lines (197 loc) · 7.27 KB
/
WT_P10_Signup.htm
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
<!DOCTYPE html>
<html>
<head>
<title>Jewellery Shopping Website SignUp</title>
<style>
h1{
background-color: black;
padding: 5px;
border-radius: 20px;
}
#Header{
height: 10%;
width: max-content;
/* background-color: #333; */
background-color: black;
color: gold;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 20px;
border-radius: 25px;
}
body{
height: 100vh;
/* background-image: linear-gradient(135deg, rgba(255,215,0,0.7), lightyellow, rgba(255, 215, 0, 0.7)); */
background-image: url(loginbg.jpg);
background-repeat: no-repeat;
background-size: cover;
}
#SignUpContainer{
height: max-content;
width: 500px;
margin-top: 25vh;
margin-left: auto;
margin-right: auto;
border: 2px solid black;
border-radius: 20px;
padding: 10px;
box-shadow: 0px 3px 10px rgba(0,0,0,0.5);
background-color: rgba(248, 220, 63, 0.5);
}
#SignUpHeader{
height: 20%;
width: 95%;
text-align: center;
margin-left: auto;
margin-right: auto;
margin-top: 1px;
margin-bottom: 5px;
padding: 2px;
font-family: 'Times New Roman';
font-size: large;
font-weight: bold;
background-color: black;
border-radius: 50px;
color: gold;
display: flex;
justify-content: center;
align-items: center;
}
.SignUpContent{
height: 20%;
width: 90%;
font-family: 'Times New Roman';
font-size: larger;
font-weight: bold;
display: flex;
justify-content: center;
align-items: center;
}
.SignUpContent input{
margin: 10px;
height: 30px;
font-size: large;
}
#SignUpFooter{
width: max-content;
margin-top: 10px;
margin-left: auto;
margin-right: auto;
}
#SignUpFooter button{
height: max-content;
margin: 5px;
padding: 3px;
border-radius: 5px;
background-color: black;
color: gold;
font-size: large;
font-family: 'Times New Roman';
font-weight: bold;
}
#SignUpFooter button:hover{
background-color: rgb(255, 170, 0);
color: white;
}
span{
margin: auto;
color: black;
font-size: medium;
overflow: auto;
background-color: white;
}
</style>
<script src="WT_P10.js"></script>
</head>
<body>
<div id="Header">
<h1>Welcome To Chandrajeet Jewellers ,</h1>
</div>
<div id="SignUpContainer">
<div id="SignUpHeader"><h2>Sign Up</h2></div>
<div class="SignUpContent" id="Username">
Username : <input type="text" id="uname" maxlength="30" placeholder="Shubh">
</div>
<div class="SignUpContent" id="Username">
Password : <input type="password" id="upass" placeholder="xxxxxx" maxlength="6" onblur="return pass_validation()">
</div>
<div id="SignUpFooter">
<button onclick="FindUser()" onclick="return onSignUp()">Sign Up</button>
<a href="WT_P10_Login.htm"><button>Login</button></a>
</div>
<span id="passwordstatus"></span>
</div>
<script language="javascript">
function FindUser() {
var uname = document.getElementById('uname').value;
var upass = document.getElementById('upass').value;
var found1 = 0;
var found2 = 0;
var size = 0;
if(uname == "" || upass == ""){
alert("Bad Credentials..!!");
window.location.replace("WT_P10_Signup.htm");
}
else{
let DB = [localStorage.getItem('CJDB')];
let DBarr = String(DB).split("}");
DBarr.forEach(user => {
// prompt(user);
size++;
if (user.includes(uname)) {
found2 = 1;
DBarr.forEach(user => {
if (user.includes(uname) && user.includes(upass)) {
window.location.replace("WT_P10_Login.htm");
found1 = 1;
}
});
}
});
if(found2 == 1){
alert("Username is Already exist..!!");
}
else if(found1 != 1){
// prompt(size);
addToDB(DB, size, uname, upass);
alert("Successfully Signed Up..!!");
}
}
}
function pass_validation() {
pass = document.getElementById("upass").value;
const re_pass = /^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*\W).{6}$/;
let result1 = re_pass.test(pass);
if (pass == "") {
passwordstatus.innerHTML = " *Enter the password..!!";
return false;
}
else {
passwordstatus.innerHTML = null;
}
if (!result1) {
passwordstatus.innerHTML = " *The password should contain 6 characters with at least one uppercase, one lowercase, one digit, and one special character."
document.getElementById("upass").focus();
return false;
}
else {
passwordstatus.innerHTML = null;
}
return true;
}
function onSignUp(event){
let f1 = pass_validation();
if (!(f1)){
event.preventDefault();
passwordstatus.innerHTML = "Something is wrong..!!"
}
else{
// alert("Form submitted Successfully..!!");
return true;
}
}
</script>
</body>
</html>