forked from NdunguMaina/Magic-Book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsign_up.html
93 lines (91 loc) · 2.95 KB
/
sign_up.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sign Up</title>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #f0f2f5;
}
.container {
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
text-align: center;
}
.container h2 {
margin-bottom: 20px;
}
.container input[type="text"],
.container input[type="email"],
.container input[type="password"] {
width: 100%;
padding: 10px;
margin: 10px 0;
border: 1px solid #ccc;
border-radius: 4px;
}
.container button {
width: 100%;
padding: 10px;
background-color: #007bff;
border: none;
border-radius: 4px;
color: white;
font-size: 16px;
cursor: pointer;
}
.container button:hover {
background-color: #0056b3;
}
.container a {
display: block;
margin-top: 10px;
color: #007bff;
text-decoration: none;
}
.container a:hover {
text-decoration: underline;
}
</style>
</head>
<body>
<div class="container">
<h2>Sign Up</h2>
<form onsubmit="signUp(event)">
<input type="email" id="email" placeholder="Email" required>
<input type="text" id="username" placeholder="Username" required>
<input type="password" id="password" placeholder="Password" required>
<input type="password" id="confirmPassword" placeholder="Confirm Password" required>
<button type="submit">Sign Up</button>
</form>
<a href="sign_in.html">Already have an account? Sign In</a>
</div>
<script>
function signUp(event) {
event.preventDefault();
const email = document.getElementById('email').value;
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
const confirmPassword = document.getElementById('confirmPassword').value;
if (password !== confirmPassword) {
alert('Passwords do not match');
return;
}
// Save user data (for simplicity, using localStorage)
localStorage.setItem('user', JSON.stringify({ email, username, password }));
localStorage.setItem('signedIn', 'true');
window.location.href = 'index.html';
}
</script>
</body>
</html>