forked from apu52/Travel_Website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loginPage.html
59 lines (52 loc) · 2.35 KB
/
loginPage.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Login Page</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css"
integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="icon" type="image/x-icon" href="favicon.ico"/>
<link rel="stylesheet" href="./loginPage.css">
</head>
<body>
<div class="main-container">
<div class="form-container">
<div class="content">
<h1>Welcome Back !</h1>
<p>Login with your personal information.</p>
<form action="" id="loginForm">
<input type="email" name="email" id="email" placeholder="Email" >
<input type="password" name="password" id="password" placeholder="Password">
<button type="submit" >Login</button>
</form>
<div class="passForget">Forgot your password?</div>
<text>Don't have an account? <a href="registerPage.html" class="register-link">Please Register here.<a></a></text>
</div>
</div>
</div>
</div>
<script>
document.getElementById('loginForm').addEventListener('submit', function(event) {
event.preventDefault();
var email = document.getElementById('email').value;
var password = document.getElementById('password').value;
if (email.trim() === '' || password.trim() === '') {
localStorage.setItem('isLoggedIn', 'true');
alert('Please fill out all fields.');
} else {
var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;
if (!emailPattern.test(email)) {
localStorage.setItem('isLoggedIn', 'true');
alert('Please enter a valid email!');
} else {
localStorage.setItem('isLoggedIn', 'true');
alert('Login successful!');
window.location.href = './index.html';
}
}
});
</script>
</body>
</html>