website/web/templates/admin/user_actions.html
Noah e4406feb1e Admin Actions
* Add impersonate feature
* Add ban/unban user feature
* Add promote/demote admin status feature
* Add admin user deletion feature
* Admin ability to see other status certification pics
* Nav bar indicator of pending admin actions such as cert pics
  needing approval
* Admin ability to search cert pics for specific user
2022-08-14 16:27:57 -07:00

166 lines
8.0 KiB
HTML

{{define "title"}}Compose a Message{{end}}
{{define "content"}}
<div class="container">
<section class="hero is-info is-bold">
<div class="hero-body">
<div class="container">
<h1 class="title">
Admin Action
</h1>
<h2 class="subtitle">On user {{.User.Username}}</h2>
</div>
</div>
</section>
<div class="block p-4">
<div class="columns is-centered">
<div class="column is-half">
<div class="card" style="width: 100%; max-width: 640px">
<header class="card-header has-background-link">
<p class="card-header-title has-text-light">
{{if eq .Intent "impersonate"}}
<span class="icon"><i class="fa fa-ghost"></i></span>
Impersonate User
{{else if eq .Intent "ban"}}
<span class="icon"><i class="fa fa-ban"></i></span>
Ban User
{{else if eq .Intent "promote"}}
<span class="icon"><i class="fa fa-gavel"></i></span>
Promote User
{{else if eq .Intent "delete"}}
<span class="icon"><i class="fa fa-trash"></i></span>
Delete User
{{end}}
</p>
</header>
<div class="card-content">
<div class="media block">
<div class="media-left">
<figure class="image is-64x64">
{{if .User.ProfilePhoto.ID}}
<img src="{{PhotoURL .User.ProfilePhoto.CroppedFilename}}">
{{else}}
<img src="/static/img/shy.png">
{{end}}
</figure>
</div>
<div class="media-content">
<p class="title is-4">{{or .User.Name "(no name)"}}</p>
<p class="subtitle is-6">
<span class="icon"><i class="fa fa-user"></i></span>
<a href="/u/{{.User.Username}}" target="_blank">{{.User.Username}}</a>
</p>
</div>
</div>
<form action="/admin/user-action" method="POST">
{{InputCSRF}}
<input type="hidden" name="intent" value="{{.Intent}}">
<input type="hidden" name="user_id" value="{{.User.ID}}">
{{if eq .Intent "impersonate"}}
<div class="block content">
<h3>With great power...</h3>
<p>
By <strong>impersonating</strong> this user, you will be considered as "logged in"
to their account and have access to their messages, profile, photos and settings.
</p>
<p>
Please respect user privacy and only impersonate an account as needed to diagnose
a customer support issue or similar.
</p>
</div>
<div class="field has-text-centered">
<button type="submit" class="button is-success">
Log in as {{.User.Username}}
</button>
</div>
{{else if eq .Intent "ban"}}
<div class="block content">
<p>
This user is currently:
{{if eq .User.Status "active"}}
<strong class="has-text-success">Active (not banned)</strong>
{{else if eq .User.Status "disabled"}}
<strong class="has-text-warning">Disabled</strong>
{{else if eq .User.Status "banned"}}
<strong class="has-text-danger">Banned</strong>
{{end}}
</p>
<p>
Select a new status for them below:
</p>
</div>
<div class="field has-text-centered">
<button type="submit" name="status" value="active" class="button is-success">
Active
</button>
<button type="submit" name="status" value="banned" class="button is-danger">
Banned
</button>
</div>
{{else if eq .Intent "promote"}}
<div class="block content">
<p>
This user is currently:
{{if .User.IsAdmin}}
<strong class="has-text-danger">Admin</strong>
{{else}}
<strong class="has-text-success">NOT Admin</strong>
{{end}}
</p>
<p>
Select a new status for them below:
</p>
</div>
<div class="field has-text-centered">
<button type="submit" name="action" value="promote" class="button is-success">
Make Admin
</button>
<button type="submit" name="action" value="demote" class="button is-danger">
Remove Admin
</button>
</div>
{{else if eq .Intent "delete"}}
<div class="block content">
<p>
Click the button below to <strong>deep delete</strong> this user account.
</p>
</div>
<div class="field has-text-centered">
<button type="submit" class="button is-danger">
Delete User Account
</button>
</div>
{{end}}
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
window.addEventListener("DOMContentLoaded", (event) => {
let $file = document.querySelector("#file"),
$fileName = document.querySelector("#fileName");
$file.addEventListener("change", function() {
let file = this.files[0];
$fileName.innerHTML = file.name;
});
});
</script>
{{end}}