-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
212 lines (209 loc) · 7 KB
/
index.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="theme-color" content="#000000" />
<title>VERTEX BERLIN</title>
<link rel="stylesheet" href="./style.css" />
</head>
<body>
<div id="sidebar">
<div id="logo">
<p id="vertex">VERTEX</p>
<p class="text-mono">Nightclub</p>
</div>
</div>
<div id="form">
<p class="text">
This is not a real online service! You know you need something like this
in your life to help you realize your deepest dreams.
<br />
Sign up now to get started.
<br />
<br />
You know you want to.
</p>
<form id="user-input" class="text-mono">
<p class="text">Let's do this!</p>
<p>Required fields are marked with an asterisk (*).</p>
<div class="row">
<div>
<input
type="text"
id="first-name"
name="first-name"
title="Please enter a valid first name, example: John"
oninvalid="setCustomValidity('Please enter a valid first name, example: John')"
pattern="\w{2,}"
placeholder=" "
required
autofocus
/>
<label for="first-name">First Name*</label>
<span></span>
</div>
<div>
<input
type="text"
id="last-name"
name="last-name"
title="Please enter a valid last name, example: Smith"
oninvalid="setCustomValidity('Please enter a valid last name, example: Smith')"
pattern="\w{3,}"
placeholder=" "
required
/>
<label for="last-name">Last Name*</label>
<span></span>
</div>
</div>
<div class="row">
<div>
<input
type="email"
id="email"
name="email"
title="Please enter a valid email address, example: name@company.com"
oninvalid="setCustomValidity('Please enter a valid email address, example: name@company.com')"
pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$"
placeholder=" "
required
/>
<label for="email">E-Mail*</label>
<span></span>
</div>
<div>
<input
type="text"
d="phone"
name="phone"
inputmode="numeric"
title="Please enter a valid phone number, example: 012345678901"
oninvalid="setCustomValidity('Please enter a valid phone number, example: 012345678901')"
pattern="\d{11,12}"
placeholder=" "
/>
<label for="phone">Phone Number</label>
<span></span>
</div>
</div>
<div class="row">
<div>
<input
type="password"
id="password"
name="password"
title="Please enter a valid password with 2 uppercase, 2 lowercase, 2 number, 2 special and min 8 Chars"
oninvalid="setCustomValidity('Please enter a valid password with 2 uppercase, 2 lowercase, 2 number, 2 special and min 8 Chars')"
pattern="^(?=(?:.*\d){2,})(?=^.{10,}$)(?=(?:.*[A-Z]){2,})(?=(?:.*[a-z]){2,})(?=(?:.*[!@#$%^&*()_+\-=\[\]{};':\\|,.\/?]){2,}).*$"
placeholder=" "
required
/>
<label for="password">Password*</label>
<span data-content="- Use a strong password"></span>
</div>
<div>
<input
type="password"
id="confirm-password"
name="confirm-password"
title="Please enter the same password as before"
oninvalid="setCustomValidity('Please enter the same password as before')"
placeholder=" "
novalidate
required
/>
<label for="confirm-password">Confirm Password*</label>
<span></span>
</div>
</div>
<div class="checkbox">
<input type="checkbox" id="news" name="news" />
<label for="news">Do you want to subscribe to our newsletter?</label>
</div>
</form>
<button form="user-input" type="submit" class="signup text-mono">
Sign Up
</button>
<p class="text">
Go back to
<a href="https://github.com/TomSoerr/odin-sign-up-form">GitHub</a>?
</p>
</div>
<!-- password strength validation with js -->
<script>
const infoBox = document.querySelector("input#password ~ span", ":after");
const dataset = infoBox.dataset;
const passwdBox = document.querySelector("input#password");
passwdBoxConfirm = document.querySelector("input#confirm-password");
dataset.content =
"- At least 2 numbers\n- At least 10 characters\n- At least 2 uppercase letters\n- At least 2 lowercase letters\n- At least 2 special characters\n";
passwdBox.addEventListener("input", (e) => {
const value = passwdBox.value;
dataset.content = "";
if (!value.match(/(?=(?:.*\d){2,}).*/)) {
dataset.content = dataset.content + "- At least 2 numbers\n";
}
if (!value.match(/(?=^.{10,}$)/)) {
dataset.content = dataset.content + "- At least 10 characters\n";
}
if (!value.match(/(?=(?:.*[A-Z]){2,}).*/)) {
dataset.content =
dataset.content + "- At least 2 uppercase letters\n";
}
if (!value.match(/(?=(?:.*[a-z]){2,}).*/)) {
dataset.content =
dataset.content + "- At least 2 lowercase letters\n";
}
if (
!value.match(/(?=(?:.*[!@#$%^&*()_+\-=\[\]{};':\\|,.\/?]){2,}).*/)
) {
dataset.content =
dataset.content + "- At least 2 special characters\n";
}
});
passwdBoxConfirm.addEventListener("input", (e) => {
if (passwdBox.value == passwdBoxConfirm.value) {
passwdBoxConfirm.setCustomValidity("");
} else {
passwdBoxConfirm.setCustomValidity("Passwords do not match.");
}
});
</script>
<a
style="
position: fixed;
bottom: 0;
right: 0;
color: black;
background-color: white;
text-decoration: none;
font-size: 16px;
font-family: sans-serif;
padding: 2px;
border: thin solid black;
text-decoration: underline;
"
href="https://tomsoerr.github.io/#/impressum"
>
Imprint
</a>
<span
style="
z-index: 1000;
position: fixed;
bottom: 0;
left: 0;
color: black;
background-color: white;
text-decoration: none;
font-size: 16px;
font-family: sans-serif;
padding: 2px;
border: thin solid black;
"
>
Not a commercial site, only for educational purposes.
</span>
</body>
</html>