-
Notifications
You must be signed in to change notification settings - Fork 0
/
sign.html
106 lines (95 loc) · 3.2 KB
/
sign.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login</title>
<style>
body {
font-family: Arial, sans-serif;
background-color: #f4f4f4;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
}
.login-container {
background-color: #b4eff9;
padding: 40px;
border-radius: 8px;
box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.1);
width: 400px;
text-align: center;
}
input[type="email"], input[type="password"] {
width: 90%;
padding: 10px;
margin: 10px 0;
border: 1px solid #793232;
border-radius: 5px;
font-size: 16px;
}
button {
padding: 12px 24px;
background-color: #5cb85c;
border: none;
color: white;
font-size: 16px;
border-radius: 5px;
cursor: pointer;
}
button:hover {
background-color: #4cae4c;
}
.footer-link {
margin-top: 15px;
}
.footer-link a {
text-decoration: none;
color: #1e1ec4;
}
.error-message {
color: red;
margin-top: 10px;
display: none;
}
</style>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<form id="loginForm" action="/submit_login" method="post" class="filling" onsubmit="return validateForm()">
<input type="email" id="email" placeholder="Enter your email" required><br>
<input type="password" id="password" placeholder="Enter your password" required><br>
<button type="submit">Login</button>
</form>
<div class="footer-link">
<p>Don't have an account? <a href="account.html">Create one</a></p>
</div>
<div class="error-message" id="errorMessage">Please fill out both fields correctly.</div>
</div>
<script>
function validateForm() {
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
var errorMessage = document.getElementById('errorMessage');
errorMessage.style.display = 'none';
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
if (!emailPattern.test(email)) {
errorMessage.textContent = 'Please enter a valid email address.';
errorMessage.style.display = 'block';
return false; // Stop form submission
}
if (password === '') {
errorMessage.textContent = 'Password cannot be empty.';
errorMessage.style.display = 'block';
return false;
}
alert('Login Successful! Redirecting...');
window.location.href = '/dashboard';
return false;
}
</script>
</body>
</html>