-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
24 lines (21 loc) · 933 Bytes
/
script.js
File metadata and controls
24 lines (21 loc) · 933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function showLogin(role) {
document.getElementById('login-modal').style.display = 'block';
sessionStorage.setItem('role', role);
}
function closeLogin() {
document.getElementById('login-modal').style.display = 'none';
}
function login() {
const username = document.getElementById('username').value;
const password = document.getElementById('password').value;
const role = sessionStorage.getItem('role');
if (username === 'admin' && password === 'admin123' && role === 'admin') {
window.location.href = 'admin-dashboard.html';
} else if (username === 'vendor' && password === 'vendor123' && role === 'vendor') {
window.location.href = 'vendor-dashboard.html';
} else if (username === 'user' && password === 'user123' && role === 'user') {
window.location.href = 'user-dashboard.html';
} else {
alert('Incorrect credentials!');
}
}