akf-forum/views/admin.ejs

40 lines
1 KiB
Text
Raw Normal View History

2022-03-13 16:16:46 +03:00
<!DOCTYPE html>
<html lang="en">
2022-03-26 23:28:10 +03:00
<%- include("extra/header", {title: "Admin panel!" }) %>
2022-03-13 16:16:46 +03:00
2022-03-26 23:28:10 +03:00
<body>
2022-03-13 16:16:46 +03:00
2022-03-26 23:28:10 +03:00
<%- include("extra/navbar", {user}) %>
2022-03-13 16:16:46 +03:00
2022-03-26 23:28:10 +03:00
<h1>Welcome to the admin panel of the forum, <%= user.name %>!</h1>
2022-03-22 21:25:09 +03:00
2022-08-11 03:48:35 +03:00
<form>
2022-04-06 22:49:16 +03:00
<h2>Write an ID to give someone admin permissions:</h2>
2022-03-26 23:28:10 +03:00
<input name="userid"></input>
<hr>
2022-08-11 15:36:28 +03:00
<button class="big" type="submit">Give admin permissions!</button>
2022-03-26 23:28:10 +03:00
</form>
2022-03-22 21:25:09 +03:00
2022-08-11 03:48:35 +03:00
<script type="module">
import request from "../../js/request.js";
document.addEventListener("submit", async e => {
e.preventDefault();
const response = await request("/api/users/" + e.target[0].value + "/admin");
if (response.admin)
alert("Making admin of "+response.name+" is success!");
2022-08-11 03:48:35 +03:00
});
2022-03-26 23:28:10 +03:00
</script>
2022-03-22 21:25:09 +03:00
2022-08-11 03:48:35 +03:00
<%- include("extra/footer") %>
2022-03-22 21:25:09 +03:00
2022-03-26 23:28:10 +03:00
</body>
2022-03-13 16:16:46 +03:00
2022-08-11 03:48:35 +03:00
</html>