2022-03-13 16:16:46 +03:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html lang="en">
|
|
|
|
|
2022-08-26 21:04:30 +03:00
|
|
|
<%- include("extra/meta", {title: member.name }) %>
|
2022-03-26 23:28:10 +03:00
|
|
|
|
2022-08-28 18:10:41 +03:00
|
|
|
<link rel="stylesheet" href="/css/user.css" />
|
|
|
|
|
|
|
|
<body >
|
|
|
|
<%- include("extra/navbar") %>
|
|
|
|
|
|
|
|
<div class="content">
|
|
|
|
<div class="box" style="justify-content:center;">
|
|
|
|
<img style="width:100px;height:100px;border-radius:50%;" src="<%=member.avatar %>">
|
|
|
|
</div>
|
|
|
|
<div class="box">
|
|
|
|
<h2 class="box-title">Name: <%= member.name %>
|
|
|
|
</h2>
|
|
|
|
<h2 class="box-title">
|
|
|
|
<%= member.name %>
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="box">
|
|
|
|
<h2 class="box-title">Created at:
|
|
|
|
</h2>
|
|
|
|
<h2 class="box-title">
|
|
|
|
<%= new Date(member.time).toLocaleString() %>
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
<div class="box">
|
|
|
|
|
|
|
|
<h2 class="box-title">Is admin?
|
|
|
|
</h2>
|
|
|
|
<h2 class="box-title">
|
|
|
|
<%= member.admin ? "Yes" : "No" %>
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="box">
|
|
|
|
|
|
|
|
<h2 class="box-title"> Message:
|
|
|
|
</h2>
|
|
|
|
<h2 class="box-title">
|
|
|
|
<%= counts.message %>
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
<div class="box">
|
|
|
|
|
|
|
|
<h2 class="box-title"> Thread:
|
|
|
|
</h2>
|
|
|
|
<h2 class="box-title">
|
|
|
|
<%= counts.thread %>
|
|
|
|
</h2>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% if (user?.admin && !member.deleted) {%>
|
|
|
|
<a class="big" id="admin">Give admin permissions!</a>
|
|
|
|
|
|
|
|
<a class="big" id="delete">Delete user!</a>
|
|
|
|
|
|
|
|
<script type="module">
|
|
|
|
|
|
|
|
import request from "../../js/request.js";
|
|
|
|
document.addEventListener("click", async e => {
|
|
|
|
e.preventDefault();
|
|
|
|
if (e.target.id == "admin") {
|
|
|
|
|
|
|
|
const response = await request("/api/users/<%= member.id %>/admin");
|
|
|
|
|
|
|
|
if (response.admin)
|
|
|
|
return alert("Making admin of " + response.name + " is success!");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
const response = await request("/api/users/<%= member.id %>/delete");
|
|
|
|
|
|
|
|
if (!response.deleted) return
|
|
|
|
alert("User is deleted!");
|
|
|
|
location.reload()
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
</script>
|
|
|
|
<% }; %>
|
|
|
|
<% if (member.deleted) {%>
|
|
|
|
<h1>This user has been deleted!</h1>
|
|
|
|
<a onclick="undelete();" type="">Undelete user! </a>
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-26 21:04:30 +03:00
|
|
|
<script type="module">
|
2022-08-28 18:10:41 +03:00
|
|
|
|
2022-08-26 21:04:30 +03:00
|
|
|
import request from "../../js/request.js";
|
2022-08-28 18:10:41 +03:00
|
|
|
async function undelete(params) {
|
|
|
|
|
|
|
|
const response = await request("/api/users/<%= member.id %>/undelete");
|
|
|
|
|
|
|
|
if (response.deleted) return;
|
|
|
|
alert("User is undeleted successfully!");
|
2022-08-27 10:31:16 +03:00
|
|
|
location.reload()
|
2022-08-28 18:10:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-26 21:04:30 +03:00
|
|
|
</script>
|
2022-08-28 18:10:41 +03:00
|
|
|
<% }; %>
|
|
|
|
</body>
|
2022-03-13 16:16:46 +03:00
|
|
|
|
2022-08-28 18:10:41 +03:00
|
|
|
</html>
|