-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.html
59 lines (56 loc) · 1.85 KB
/
login.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</title>
<link href="style.css" rel="stylesheet" type="text/css">
<script>
function showAlert(type, message) {
alert(message);
}
// Function to get URL parameters
function getParameterByName(name, url) {
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, '\\$&');
var regex = new RegExp('[?&]' + name + '(=([^&#]*)|&|#|$)'),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, ' '));
}
// Check if error parameter is present in URL
document.addEventListener('DOMContentLoaded', function() {
var error = getParameterByName('error');
if (error === 'InvalidCredentials') {
showAlert('error', 'Incorrect username or password');
}
});
document.addEventListener('DOMContentLoaded', function() {
var error = getParameterByName('error');
if (error === 'LoggedOut') {
showAlert('error', 'You have been logged out');
}
});
</script>
</head>
<body>
<div class="login-container">
<h2>Login</h2>
<form action="authenticate.php" method="post">
<div class="form-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" required>
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" id="password" name="password" required>
</div>
<div class="form-group not_registered">
<a href="register.html" style="color:aqua">Not Registered?</a>
</div>
<button type="submit" class="login-btn">Login</button>
</form>
</div>
</body>
</html>