-
Notifications
You must be signed in to change notification settings - Fork 3
/
createaccount.html
70 lines (63 loc) · 2.79 KB
/
createaccount.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
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Create an Account | PreBook</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="shortcut icon" type="image/png" href="img/logo.png">
</head>
<body>
<nav>
<div class="logo">
<img src="img/logo.png"> <h1> PreBook</h1><span><i>Cheap, Reliable, Instant</i></span>
</div>
</nav>
<main>
<div class="bar">
<h2>Welcome to PreBook (Sign Up)</h2>
<span class="aside"><i>Fill out the information below to sign up for an account, and start booking tickets to your favorite movies</i></span>
</div>
<form method="post" action="create.php" id="createform" onsubmit="return validateForm()">
<span>Username</span>
<input type="text" name="desiredusername" placeholder="Desired Username" id="username" class="form-input">
<span>Password</span>
<input type="password" name="desiredpassword" placeholder="Desired Password" id="password" class="form-input">
<button type="submit" name="submit" id="submit" class="form-button">Sign Up</button>
<a href="index.html">
<button type="button" name="back" class="form-button aside-button">Back</button>
</a>
</form>
</main>
<script type="text/javascript">
var form = document.getElementById('createform');
var username;
var password;
var button = document.getElementById('submit');
var reOneNum = new RegExp("/\d/");
var reOneAl = new RegExp("/[A-Z]/i");
var reFinal = new RegExp("([A-Za-z]+[0-9]|[0-9]+[A-Za-z])[A-Za-z0-9]*");
var reAlnum = new RegExp("^[a-zA-Z0-9]*$");
function validateForm() {
username = document.getElementById('username').value;
password = document.getElementById('password').value;
if (username.length == 0 || password.length == 0) {
alert("Please do no leave the fields empty");
return false;
}
else if (username.length < 3) {
alert("Username must be longer than 3 characters");
return false;
}
else if (!reAlnum.test(username)) {
alert("Username can only consist of characters and numbers");
return false;
}
else if (password.length < 6 || password.length > 15 || !reFinal.test(password) ) {
alert("The length of the password must be between 6 to 15 characters and it must consist of only alphanumerical characters with at least one alphabet and one numerical character");
return false;
}
}
</script>
</body>
</html>