Merge branch 'main' of https://github.com/CodingTurtle2/gmci_project
This commit is contained in:
commit
3bca723a7a
1 file changed
+26
-16
+26
-16
@@ -1,31 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="./lib/basic.css">
|
||||
<script src="./auth.js"></script>
|
||||
<script src="./lib/basic.js"></script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login</title>
|
||||
<link rel="stylesheet" href="./lib/basic.css">
|
||||
<script src="./auth.js"></script>
|
||||
<script src="./lib/basic.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<input id="username"><br>
|
||||
<input type="password" id="password">
|
||||
<input id="username"><br>
|
||||
<input type="password" id="password">
|
||||
|
||||
<button onclick="login()">Submit</button>
|
||||
<button onclick="login()">Submit</button>
|
||||
|
||||
<script>
|
||||
<script>
|
||||
|
||||
const couchDB = new CouchDB();
|
||||
const couchDB = new CouchDB();
|
||||
|
||||
async function getData() {
|
||||
async function getData() {
|
||||
let res = await couchDB.get("users");
|
||||
if (!res) res = {};
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
async function login() {
|
||||
async function login() {
|
||||
const data = await getData();
|
||||
const username = getId("username").value.toLowerCase();
|
||||
const password = getId("password").value;
|
||||
@@ -41,10 +43,18 @@ async function login() {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (user.role) {
|
||||
case "professor":
|
||||
location.href = "./prof/uebersicht.html?user=" + username;
|
||||
}
|
||||
return;
|
||||
case "student":
|
||||
location.href = "./student/uebersicht.html?user=" + username;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in new issue
Block a user