2022-08-13 22:39:31 +00:00
{{define "title"}}Admin - Certification Photos{{end}}
{{define "content"}}
2022-08-14 23:27:57 +00:00
{{$Root := .}}
2022-08-13 22:39:31 +00:00
< div class = "container" >
< section class = "hero is-danger is-bold" >
< div class = "hero-body" >
< div class = "container" >
< h1 class = "title" >
Admin / Certification Photos
< / h1 >
< / div >
< / div >
< / section >
< div class = "block p-4" >
2022-08-14 23:27:57 +00:00
< div class = "columns" >
< div class = "column" >
{{if .Pager}}
There {{Pluralize64 .Pager.Total "is" "are"}} < strong > {{.Pager.Total}}< / strong > Certification Photo{{Pluralize64 .Pager.Total}}
{{if eq .View "pending"}}
needing approval.
{{else}}
at status "{{.View}}."
{{end}}
{{else if .FoundUser}}
Found user < strong > < a href = "/u/{{.FoundUser.Username}}" class = "has-text-dark" > {{.FoundUser.Username}}< / a > < / strong >
(< a href = "mailto:{{.FoundUser.Email}}" > {{.FoundUser.Email}}< / a > )
{{end}}
< / div >
< div class = "column is-narrow" >
< div class = "tabs is-toggle" >
< ul >
< li { { if eq . View " pending " } } class = "is-active" { { end } } >
< a href = "{{.Request.URL.Path}}?view=pending" > Needing Approval< / a >
< / li >
< li { { if eq . View " approved " } } class = "is-active" { { end } } >
< a href = "{{.Request.URL.Path}}?view=approved" > Approved< / a >
< / li >
< li { { if eq . View " rejected " } } class = "is-active" { { end } } >
< a href = "{{.Request.URL.Path}}?view=rejected" > Rejected< / a >
< / li >
< / ul >
< / div >
< / div >
< / div >
2022-08-13 22:39:31 +00:00
< div class = "block" >
2022-08-14 23:27:57 +00:00
< form method = "GET" action = "{{.Request.URL.Path}}" >
< div class = "field block" >
< div class = "label" for = "username" > Search username or email:< / div >
< input type = "text" class = "input"
name="username"
id="username"
placeholder="Press Enter to search">
< / div >
< / form >
2022-08-13 22:39:31 +00:00
< / div >
2022-08-14 23:27:57 +00:00
{{if .Pager}}
2023-06-22 03:46:27 +00:00
{{SimplePager .Pager}}
2022-08-14 23:27:57 +00:00
{{end}}
2022-08-13 22:39:31 +00:00
< div class = "columns is-multiline" >
{{range .Photos}}
< div class = "column is-one-third" >
{{$User := $Root.UserMap.Get .UserID}}
< form action = "{{$Root.Request.URL.Path}}" method = "POST" >
{{InputCSRF}}
< input type = "hidden" name = "user_id" value = "{{$User.ID}}" >
< div class = "card" style = "max-width: 512px" >
< header class = "card-header has-background-link" >
< p class = "card-header-title has-text-light" >
< span class = "icon" > < i class = "fa fa-user" > < / i > < / span >
< span > {{or $User.Username "[deleted]"}}< / span >
< / p >
< / header >
2023-08-01 03:03:21 +00:00
{{if .Filename}}
2022-08-13 22:39:31 +00:00
< div class = "card-image" >
< figure class = "image" >
< img src = "{{PhotoURL .Filename}}" >
< / figure >
< / div >
2023-08-01 03:03:21 +00:00
{{end}}
2022-08-13 22:39:31 +00:00
< div class = "card-content" >
< div class = "media block" >
< div class = "media-left" >
< figure class = "image is-48x48" >
{{if $User.ProfilePhoto.ID}}
< img src = "{{PhotoURL $User.ProfilePhoto.CroppedFilename}}" >
{{else}}
< img src = "/static/img/shy.png" >
{{end}}
< / figure >
< / div >
< div class = "media-content" >
2022-08-21 22:40:24 +00:00
< p class = "title is-4" > {{$User.NameOrUsername}}< / p >
2022-08-13 22:39:31 +00:00
< 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 >
2022-08-14 23:27:57 +00:00
< div class = "block" >
< div class = "columns" >
< div class = "column is-narrow" >
2022-08-15 00:45:55 +00:00
< strong > Status:< / strong >
2022-08-14 23:27:57 +00:00
< / div >
< div class = "column" >
{{if eq .Status "pending"}}
< strong class = "has-text-warning" > Pending Approval< / strong >
{{else if eq .Status "approved"}}
< strong class = "has-text-success" > Approved< / strong >
{{else if eq .Status "rejected"}}
< strong class = "has-text-danger" > Rejected< / strong >
{{else}}
< strong > {{.Status}}< / strong >
{{end}}
2024-05-26 19:34:00 +00:00
<!-- Secondary approved? -->
{{if .SecondaryVerified}}
< strong class = "has-text-info" >
< i class = "fa fa-id-card ml-3 mr-1" > < / i > ID Verified
< / strong >
{{end}}
2022-08-14 23:27:57 +00:00
< / div >
< / div >
< / div >
2024-05-26 19:34:00 +00:00
<!-- Secondary photo ID attached? -->
{{if .SecondaryFilename}}
< div class = "block" >
< div class = "mb-2" >
< strong class = "has-text-success" >
< i class = "fa fa-id-card" > < / i >
Secondary Photo ID Attached
< / strong >
< / div >
< img src = "{{PhotoURL .SecondaryFilename}}" >
< / div >
{{end}}
2023-11-25 22:28:16 +00:00
< div class = "block" >
< strong > < i class = "fa fa-location-dot mr-1" > < / i > GeoIP Insights:< / strong >
< div >
{{$Insights := $Root.InsightsMap.Get .IPAddress}}
{{if $Insights.IsZero}}
< span class = "has-text-danger" > No GeoIP insights available for this IP address!< / span >
{{else}}
{{$Insights.Medium}}
{{end}}
< / div >
< div >
IP: {{.IPAddress}}
< / div >
< / div >
2024-05-26 19:34:00 +00:00
<!-- Secondary ID was needed in the past for this user -->
{{if .SecondaryNeeded}}
< div class = "block is-size-7 has-text-warning" >
< i class = "fa fa-id-card" > < / i > A secondary form of ID was requested from
this user once before. They will always be asked for a secondary ID if
they replace their cert photo in the future.
< / div >
{{end}}
2022-08-13 22:39:31 +00:00
< div class = "field" >
< textarea class = "textarea" name = "comment"
cols="60" rows="2"
2022-08-14 23:27:57 +00:00
placeholder="Admin comment (for rejection)">{{.AdminComment}}< / textarea >
2023-08-01 03:03:21 +00:00
< div class = "select is-fullwidth" >
< select class = "common-reasons" >
2024-05-26 19:34:00 +00:00
< optgroup label = "Common Rejection Reasons" >
< option value = "Your certification pic should depict you holding onto a sheet of paper with your username, site name, and current date written on it." >
Didn't follow directions
< / option >
< option value = "The sheet of paper must also include the website name: nonshy" > Website name not visible< / option >
< option value = "Please take a clearer picture that shows your arm and hand holding onto the sheet of paper" > Unclear picture (hand not visible enough)< / option >
< option value = "This photo has been digitally altered, please take a new certification picture and upload it as it comes off your camera" > Photoshopped or digitally altered< / option >
< option value = "You had a previous account on nonshy which was suspended and you are not welcome with a new account." > User was previously banned from nonshy< / option >
< option value = "This is not an acceptable certification photo." > Not acceptable< / option >
< / optgroup >
< optgroup label = "Secondary Verification" >
< option value = "(secondary)" >
User appears underage, ask for secondary ID
< / option >
< / optgroup >
2023-11-25 22:28:16 +00:00
< optgroup label = "Other Actions" >
< option value = "(ignore)" > (Silently reject this photo without sending an e-mail)< / option >
< / optgroup >
2023-08-01 03:03:21 +00:00
< / select >
< / div >
2022-08-13 22:39:31 +00:00
< / div >
2024-04-05 05:24:35 +00:00
< div class = "field" >
< a href = "/admin/changelog?table_name=certification_photos&about_user_id={{$User.ID}}" class = "button is-small has-text-warning" >
< span class = "icon" > < i class = "fa fa-clipboard-list" > < / i > < / span >
< span > Change Log< / span >
< / a >
< / div >
2022-08-13 22:39:31 +00:00
< / div >
< footer class = "card-footer" >
2022-08-14 23:27:57 +00:00
{{if not (eq .Status "rejected")}}
2022-08-13 22:39:31 +00:00
< button type = "submit" name = "verdict" value = "reject" class = "card-footer-item button is-danger" >
< span class = "icon" > < i class = "fa fa-xmark" > < / i > < / span >
< span > Reject< / span >
< / button >
2022-08-14 23:27:57 +00:00
{{end}}
{{if not (eq .Status "approved")}}
2022-08-13 22:39:31 +00:00
< button type = "submit" name = "verdict" value = "approve" class = "card-footer-item button is-success" >
< span class = "icon" > < i class = "fa fa-check" > < / i > < / span >
< span > Approve< / span >
< / button >
2022-08-14 23:27:57 +00:00
{{end}}
2022-08-13 22:39:31 +00:00
< / footer >
< / div >
< / form >
< / div >
{{end}}
< / div >
< / div >
< / div >
2023-06-22 03:46:27 +00:00
{{end}}
2023-08-01 03:03:21 +00:00
{{define "scripts"}}
< script >
window.addEventListener("DOMContentLoaded", (event) => {
document.querySelectorAll("select.common-reasons").forEach(elem => {
2024-01-07 04:44:04 +00:00
let textarea = elem.parentNode.parentNode.getElementsByTagName("textarea")[0],
approveButton = elem.parentNode.parentNode.parentNode.parentNode.querySelector("button.is-success");
// Grey out the Approve button if a rejection reason is filled out.
let setApproveState = () => {
if (textarea.value.length > 0) {
approveButton.disabled = "disabled";
} else {
approveButton.disabled = null;
}
};
textarea.addEventListener("change", setApproveState);
textarea.addEventListener("keyup", setApproveState);
2023-08-01 03:03:21 +00:00
elem.addEventListener("change", (e) => {
textarea.value = elem.value;
2024-01-07 04:44:04 +00:00
setApproveState();
});
2023-08-01 03:03:21 +00:00
})
});
< / script >
{{end}}