-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate.account.html
More file actions
75 lines (73 loc) · 3.47 KB
/
create.account.html
File metadata and controls
75 lines (73 loc) · 3.47 KB
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>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Create Account - Cycle</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<link rel="stylesheet" href="css/responsive.css" />
<link rel="icon" href="images/fevicon.png" type="image/gif" />
<link href="https://fonts.googleapis.com/css?family=Poppins:400,700|Raleway:400,700,800&display=swap" rel="stylesheet" />
</head>
<body>
<div class="header_section">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<img src="images/logo.png" width="112" height="80" style="width: 112px; height: 80px;" />
</nav>
</div>
<div class="create_account_section">
<div class="container">
<div class="create_account_form">
<h2 class="create_account_title">Create New Account</h2>
<form action="index.html" method="POST" onsubmit="return handleCreateAccount(event)">
<input type="text" id="username" class="form_input" placeholder="Username" required>
<input type="email" id="email" class="form_input" placeholder="Email Address" required>
<input type="password" id="password" class="form_input" placeholder="Password" required>
<input type="password" id="confirm_password" class="form_input" placeholder="Confirm Password" required>
<button type="submit" class="create_account_btn">Create Account</button>
<div class="forgot_password">
<a href="login.html">Already have an account?</a>
</div>
<div id="errorMessage" style="color: red; display: none;"></div>
<div id="loading" style="display: none;">Loading...</div>
</form>
</div>
</div>
</div>
<script>
function handleCreateAccount(event) {
event.preventDefault();
const username = document.getElementById('username').value;
const email = document.getElementById('email').value;
const password = document.getElementById('password').value;
const confirmPassword = document.getElementById('confirm_password').value;
const errorMessage = document.getElementById('errorMessage');
const loading = document.getElementById('loading');
errorMessage.style.display = 'none';
loading.style.display = 'block';
setTimeout(function() {
if (password !== confirmPassword) {
errorMessage.textContent = 'Passwords do not match!';
errorMessage.style.display = 'block';
loading.style.display = 'none';
return false;
}
// Save new user to localStorage
let users = JSON.parse(localStorage.getItem('users') || '[]');
users.push({ email, password });
localStorage.setItem('users', JSON.stringify(users));
// Save login state to session storage
sessionStorage.setItem('loggedIn', 'true');
sessionStorage.setItem('userEmail', email);
window.location.href = 'index.html';
}, 1200);
return false;
}
</script>
</body>
</html>