forked from anuragverma108/WildGuard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Loginpage.html
143 lines (137 loc) · 4.83 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WildGuard Sign In / Sign Up</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-image: url(assets/images/zebras.jpg);
background-size:cover;
background-position: center;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
margin: 0;
color: #000000;
}
.container {
background: rgba(245, 245, 245, 0.875);
padding: 2.2rem;
border-radius: 12px;
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
width: 350px;
text-align: center;
}
h1 {
color: #016c60;
margin-bottom: 1rem;
font-size: 1.5rem;
}
.form-group {
margin-bottom: 1rem;
text-align: left;
}
label {
display: block;
margin-bottom: 0.5rem;
font-weight: bold;
}
input {
width: 100%;
padding: 0.5rem;
border: 2px solid #ccc;
border-radius: 4px;
transition: border-color 0.3s, box-shadow 0.3s;
}
input:focus {
border-color: #06796b32;
box-shadow: 0 0 5px rgba(0, 121, 107, 0.5);
outline: none;
}
button {
width: 100%;
padding: 0.85rem;
background-color: #00796b;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.3s, transform 0.3s;
}
button:hover {
background-color: #01463a78;
transform: translateY(-2px);
}
.message {
margin-top: 1rem;
font-weight: bold;
min-height: 1.5rem;
}
.toggle-link {
margin-top: 1rem;
cursor: pointer;
color: #25500a;
}
</style>
</head>
<body>
<div class="container">
<h1 id="formTitle">Sign In</h1>
<form id="authForm">
<div class="form-group">
<label for="username">Username:</label>
<input type="text" id="username" required>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" id="password" required>
</div>
<button type="submit">Sign In</button>
<p id="message" class="message"></p>
<p class="toggle-link" id="toggleLink">Don't have an account? Sign Up</p>
</form>
</div>
<script>
const authForm = document.getElementById('authForm');
const formTitle = document.getElementById('formTitle');
const messageElement = document.getElementById('message');
const toggleLink = document.getElementById('toggleLink');
const validCredentials = { username: 'admin', password: 'password' };
authForm.addEventListener('submit', function(event) {
event.preventDefault();
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
if (formTitle.textContent === 'Sign In') {
// Sign In Logic
if (username === validCredentials.username && password === validCredentials.password) {
messageElement.textContent = 'Login successful!';
messageElement.style.color = 'green';
} else {
messageElement.textContent = 'Invalid username or password.';
messageElement.style.color = 'red';
}
} else {
// Sign Up Logic (for demonstration purposes)
messageElement.textContent = 'Account created! You can now sign in.';
messageElement.style.color = 'green';
}
});
toggleLink.addEventListener('click', function() {
if (formTitle.textContent === 'Sign In') {
formTitle.textContent = 'Sign Up';
toggleLink.textContent = 'Already have an account? Sign In';
document.querySelector('button').textContent = 'Sign Up';
messageElement.textContent = ''; // Clear message
} else {
formTitle.textContent = 'Sign In';
toggleLink.textContent = "Don't have an account? Sign Up";
document.querySelector('button').textContent = 'Sign In';
messageElement.textContent = ''; // Clear message
}
});
</script>
</body>
</html>