Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

149
Views
Login depending on User Role

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>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!