2022-03-13 16:16:46 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
2022-08-11 03:03:26 +03:00
|
|
|
<%- include("extra/header", { title: member.name }) %>
|
2022-03-26 23:28:10 +03:00
|
|
|
|
|
|
|
<body>
|
|
|
|
|
2022-08-11 03:03:26 +03:00
|
|
|
<%- include("extra/navbar", { user }) %>
|
2022-03-26 23:28:10 +03:00
|
|
|
|
|
|
|
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<h1>Avatar:</h1>
|
|
|
|
<img style="width:256px;height:256px;" src=<%=member.avatar %> alt=<%= member.name %>>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li>
|
|
|
|
<h2>Name: <%= member.name %>
|
|
|
|
</h2>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<h2>Created at:
|
|
|
|
<%= new Date(member.time).toLocaleString() %>
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<h2>Is admin? <%= member.admin ? "Yes" : "No" %>
|
|
|
|
</h2>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li>
|
|
|
|
<h2> Message: <%= counts.message %>
|
|
|
|
</h2>
|
|
|
|
</li>
|
|
|
|
<li>
|
|
|
|
<h2> Thread: <%= counts.thread %>
|
|
|
|
</h2>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
2022-08-11 03:03:26 +03:00
|
|
|
<% if (user?.admin && !member.deleted) {%>
|
2022-08-11 03:48:35 +03:00
|
|
|
<form id="admin">
|
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-08-11 03:03:26 +03:00
|
|
|
<form id="delete">
|
2022-08-11 15:36:28 +03:00
|
|
|
<button class="big" type="submit">Delete user!</button>
|
2022-03-26 23:28:10 +03:00
|
|
|
</form>
|
|
|
|
|
2022-08-11 03:03:26 +03:00
|
|
|
<script type="module">
|
|
|
|
|
|
|
|
import request from "../../js/request.js";
|
|
|
|
|
|
|
|
document.addEventListener("submit", async e => {
|
|
|
|
e.preventDefault();
|
2022-08-11 03:48:35 +03:00
|
|
|
|
|
|
|
if (e.target.id == "admin") {
|
|
|
|
|
|
|
|
const response = await request("/api/users/<%= member.id %>/admin");
|
2022-08-11 17:55:48 +03:00
|
|
|
|
|
|
|
if (response.result.admin)
|
|
|
|
return alert("Making admin of " + response.result.name + " is success!");
|
2022-08-11 03:48:35 +03:00
|
|
|
|
2022-08-11 17:55:48 +03:00
|
|
|
}
|
2022-08-11 03:03:26 +03:00
|
|
|
|
2022-08-11 17:55:48 +03:00
|
|
|
const response = await request("/api/users/<%= member.id %>/delete");
|
|
|
|
|
|
|
|
if (response.result.deleted)
|
2022-08-11 03:03:26 +03:00
|
|
|
alert("User Deleted");
|
2022-08-11 17:55:48 +03:00
|
|
|
|
2022-08-11 03:03:26 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<% }; %>
|
2022-08-11 17:55:48 +03:00
|
|
|
<% if (member.deleted) {%>
|
|
|
|
<h1>This user has been deleted!</h1>
|
|
|
|
<% }; %>
|
|
|
|
|
|
|
|
<%- include("extra/footer") %>
|
2022-03-26 23:28:10 +03:00
|
|
|
</body>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-08-11 03:03:26 +03:00
|
|
|
</html>
|