I am trying to load a certain page depending on the Users login information. I have predefined User logins, if the user logins to one of the predefined accounts already hardcoded then they go to the corresponding page.
The data.js file containing the user accounts and their roles
const ROLE = {
TUTOR: 'tutor',
STUDENT: 'student'
}
module.exports = {
ROLE: ROLE,
users: [
{ id: 1, name: 'tutor', password: 'tutor', role: ROLE.TUTOR},
{ id: 2, name: 'student', password: 'student', role:ROLE.STUDENT}
]
}
The login.html
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Login Page</title>
<link rel="stylesheet" href="css/login_style.css">
</head>
<body>
<div id="login-form-wrap">
<h2>Login</h2>
<form id="login-form">
<p>
<input type="text" id="username" name="username" placeholder="Username" required></i>
</p>
<p>
<input type="password" id="password" name="password" placeholder="Password" required></i>
</p>
<p>
<input type="submit" id="login" value="Login">
</p>
</form>
<div id="footer-wrap">
<p>WMGSS - Calendar Board</p>
</div>
</div>
</body>
</html>