-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog_in.html
122 lines (121 loc) · 3.34 KB
/
log_in.html
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
<!DOCTYPE html>
<html lang="en-NG">
<head>
<title>Log in to Text Bar </title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0" >
<meta name="description" content="Text Bar Log in form" />
<meta name="keywords" content="HTML, CSS, JavaScript" />
<meta name="author" content="Umar BK" >
<script src='script/navs.js' defer></script>
<style>
*
{ box-sizing:border-box;}
html
{ background-color:#333; }
body
{ margin-top:0;}
form
{ margin:3em 0 0;
position:relative;}
form input
{ margin:0 35%;
width:30%;
border:none;
border-bottom:2px solid white;
color:white;
font-size:3em;
text-align:center;
background:#333;
outline:none;}
form button
{ position:absolute;
top:0;
right:21%;
padding:0 1%;
border-radius:5vw;
background-color:black;
font-size:xx-large;
color:white;}
form div
{ margin:11px 25% 0;
color:white;}
table
{ margin:5em 0 0;
width:100%;
color:white;}
table tr
{ text-align:center;}
table td
{ background-color:rgba(0, 0, 0, .1);
font-size:3em;
padding:5%;}
@media screen and (min-width:600px) {
table
{ width: 300px;
margin:35px auto 0;
border-radius: 1em;
background-color: rgba(255, 255, 255, .1);}
}
</style>
</head>
<body>
<header> </header>
<form>
<input type="password" placeholder="PIN" disabled="disabled" >
<button type="button" onclick="log.delete_number()"> × </button>
<div onclick="document.location='forgot_password.html'"> Forgot PIN </div>
</form>
<table>
<tr>
<td> 1 </td>
<td> 2 </td>
<td> 3 </td>
</tr>
<tr>
<td> 4 </td>
<td> 5 </td>
<td> 6 </td>
</tr>
<tr>
<td> 7 </td>
<td> 8 </td>
<td> 9 </td>
</tr>
<tr>
<td> </td>
<td> 0 </td>
<td> </td>
</tr>
</table>
<script>
(() => {
if (!localStorage.getItem('USER_DATA')) {
location.href = 'sign_up.html';
}
})();
class sign_in {
constructor(password, remove_num, user_data) {
this.password = password;
this.delete_button = remove_num;
this.data = user_data;
}
delete_number() {
this.password.value = this.password.value.slice(0, -1);
}
log_in(number) {
let input = number.target.innerText;
this.password.value += input;
this.password.value == this.data['PIN'] ? document.location = 'index.html' : '';
this.password.value.length >= 4 ? this.password.value = '' : null;
}
}
const log = new sign_in(
document.querySelector('input[type=password]'),
document.querySelector('button'),
JSON.parse(localStorage.getItem('USER_DATA'))
);
document.querySelectorAll('td').forEach(button => button.addEventListener('click', () => log.log_in(event)));
</script>
</body>
</html>