-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.html
More file actions
88 lines (81 loc) · 2.83 KB
/
admin.html
File metadata and controls
88 lines (81 loc) · 2.83 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
76
77
78
79
80
81
82
83
84
85
86
87
88
<!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: #f2f2f2;
}
.container {
max-width: 400px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
border-radius: 5px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}
h1 {
text-align: center;
}
input[type="text"],
input[type="password"],
button {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
button {
background-color: #4caf50;
color: white;
cursor: pointer;
}
button:hover {
background-color: #45a049;
}
.error {
color: red;
}
</style>
</head>
<body>
<div class="container">
<h1> Admin Login</h1>
<form id="adminForm" action="/admin" method="POST">
<input type="text" id="username" name="username" placeholder="Username" required><br>
<input type="password" id="password" name="password" placeholder="Password" required><br>
<button type="submit">Login</button>
<p id="successMessage" style="color: green;"></p>
<p id="failureMessage" style="color: red;"></p>
<p id="errorMessage" class="error"></p>
</form>
<p>Don't have an account? <a href="/adminsignup.html">Sign up here</a></p>
</div>
<script>
document.getElementById("adminForm").addEventListener("submit", function(event) {
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if (!username || !password) {
event.preventDefault();
document.getElementById("errorMessage").innerText = "Please enter both username and password.";
}
});
const urlParams = new URLSearchParams(window.location.search);
const adminSuccess = urlParams.get('adminSuccess');
const adminFailure = urlParams.get('adminFailure');
const successMessage = document.getElementById('successMessage');
const failureMessage = document.getElementById('failureMessage');
if (adminSuccess) {
successMessage.textContent = 'login successful!';
}
if (adminFailure) {
failureMessage.textContent = 'invalid credentials Please try again.';
}
</script>
</body>
</html>