This repository was archived by the owner on Mar 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreg.html
75 lines (74 loc) · 4.24 KB
/
reg.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
<!DOCTYPE html>
<meta charset="utf-8">
<html>
<head>
<link rel="stylesheet" href="./styling/logintheme.css">
<title>CodeArchive2.0 Register</title>
<script>
function setCookie(event) {
event.preventDefault();
var newusr = document.getElementById("username").value;
var newpasswd = document.getElementById("password").value;
var checkpasswd = document.getElementById("password0").value;
var checked = document.getElementById("agree").checked;
var nameRegex = /^[a-zA-Z0-9]+$/;
var validUsername = document.form.username.value.match(nameRegex);
if (newusr.length < 4) {
alert("Your username must contain at least 4 characters.\n(Should only contain a-z, A-Z and 0-9)");
} else if (validUsername == null) {
alert("Your username must only contain a-z, A-Z and 0-9.");
} else if (newpasswd.length < 6) {
alert("Your password must be at least 6 characters long.\nPlease set a longer password.");
} else if (newpasswd !== checkpasswd) {
alert("Password does not match.");
} else if (checked != true) {
alert("Please read through README.md and click the checkbox before proceeding.");
} else if ((newusr.length > 3) && (validUsername != null) && (newpasswd === checkpasswd) && (checked == true)) {
document.cookie = newusr + "=" + newpasswd + "; path=/; SameSite=None; Secure";
window.alert("Registered successfully, you can now go back and login using the new username and password.");
} else {
alert("An unknown error occured.");
}
return;
}
</script>
</head>
<body background="./media/images/loginbg.jpg">
<div>
<img src='./media/images/codearchive.gif'>
<form id="form" name='form'>
<div class="grandParentContainer">
<div class="parentContainer">
<p><a class='previous round' onclick='window.history.back();'>‹ Back to Login</a></p>
<fieldset>
<div class="form-group">
<h1 class='center'>(Temporarily) Register new user on CodeArchive2.0</h1>
<h2 class='center'>Please read through README.md before proceeding.</h2>
<label for="username0" class="center">Username</label>
<input type="username" id="username" class="form-control center">
<br>
<label for="password0" class="center">Password</label>
<input type="password" id="password" class="form-control center">
<br>
<label for="password1" class="center">Confirm password</label>
<input type="password" id="password0" class="form-control center">
<p class='center'><a onclick="window.open('./README.md', target='_self');">Open README.md</a></p>
<div>
<hr>
<input type='checkbox' id='agree' class='alignleft check-box'><span style="color: #17a8d4; font: 15px Verdana; padding-left: 5px;">I agree with the usage of Cookie</span>
<hr>
<button type="submit" class="button" onClick="setCookie(event);"><span>Confirm</span></button>
</div>
</div>
</fieldset>
</div>
</div>
</form>
</div>
</body>
<noscript>
<p1><b>Uh oh!</b></p1><br>
<p3>Looks like your browser does not support JavaScript.</p3><br>
<p>Please try to use other browsers to fix this problem.</p>
</noscript>
</html>