2020-10-29 20:50:36 -07:00
|
|
|
extends layout.pug
|
|
|
|
|
|
|
|
block title
|
|
|
|
h1(style="margin-bottom: 0;")
|
|
|
|
a(href='..') <
|
|
|
|
| #{config.siteTitle}
|
|
|
|
p Editing user "#{user._id}"
|
|
|
|
|
|
|
|
block content
|
|
|
|
.columns
|
|
|
|
.column
|
|
|
|
if user.signupToken
|
2020-10-30 08:15:00 -07:00
|
|
|
- const signupLink = `${_CC.config.base}confirm-account/${user.signupToken}`
|
2020-10-29 20:50:36 -07:00
|
|
|
.box(style='overflow: hidden;')
|
|
|
|
.columns(style='margin-bottom: 0;')
|
|
|
|
.column.is-narrow(style='padding-bottom: 0;')
|
|
|
|
h2 Confirmation Link
|
|
|
|
.column(style='padding-bottom: 0;')
|
|
|
|
p
|
|
|
|
span This account hasn't been confirmed.
|
|
|
|
br
|
|
|
|
if user.expiry > new Date().getTime()
|
|
|
|
span= `The following link expires ${_CC.require('moment')(user.expiry).fromNow()}`
|
|
|
|
else
|
|
|
|
span.has-text-weight-bold(style='color: red;')= `The following link expired ${_CC.require('moment')(user.expiry).fromNow()}`
|
|
|
|
h3(style='margin-bottom: 0; margin-top: 0;')
|
|
|
|
.level
|
|
|
|
.level-left
|
|
|
|
.level-item
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/refresh-signup-token/${user._id}`)
|
|
|
|
input.button.is-rounded(type='submit', value='Generate New Link')
|
|
|
|
.level-item
|
2020-10-30 08:15:00 -07:00
|
|
|
a(href=signupLink, style='font-family: monospaced; word-break: break-all;')= signupLink
|
2020-11-03 17:25:20 -08:00
|
|
|
.columns
|
|
|
|
.column.is-narrow
|
|
|
|
h2 Change Name
|
|
|
|
form(action=`${_CC.config.base}admin-settings/edit/rename/${user._id}`, method='POST')
|
|
|
|
.field
|
|
|
|
label.label Username
|
|
|
|
.control.has-icons-left
|
|
|
|
input.input(type='text', name='newUsername', placeholder=user._id, value=user._id)
|
|
|
|
span.icon.is-small.is-left
|
|
|
|
i.fas.fa-user
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
input.button.is-primary(type='submit' value='Change Username')
|
|
|
|
.column.is-narrow
|
2021-01-02 14:07:07 -08:00
|
|
|
h2 Admin
|
|
|
|
//- Yes, ternary exists, but I think the code is cleaner with a more "naive" style :)
|
|
|
|
//- p.is-marginless #{user._id} is #{user.admin ? '' : 'not '}an admin.
|
|
|
|
//- vs.
|
|
|
|
if user.admin
|
|
|
|
p.is-marginless #{user._id} is an admin.
|
|
|
|
form(action=`${_CC.config.base}admin-settings/edit/demote/${user._id}`, method='POST')
|
2020-11-03 17:25:20 -08:00
|
|
|
.field
|
|
|
|
.control
|
2021-01-02 14:07:07 -08:00
|
|
|
if user._id === req.user._id
|
|
|
|
input.input.button(disabled, type='submit', value=`You cannot demote yourself`, style='margin-top: 1em;')
|
|
|
|
else
|
|
|
|
input.input.button(type='submit', value=`Demote ${user._id}`, style='margin-top: 1em;')
|
|
|
|
else
|
|
|
|
p.is-marginless #{user._id} is not an admin.
|
|
|
|
form(action=`${_CC.config.base}admin-settings/edit/promote/${user._id}`, method='POST')
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
input.input.button(type='submit', value=`Promote ${user._id}`, style='margin-top: 1em;')
|
|
|
|
if user._id !== req.user._id
|
|
|
|
.column.is-narrow
|
|
|
|
h2 Impersonate
|
|
|
|
form(action=`${_CC.config.base}admin-settings/edit/impersonate/${user._id}`, method='POST')
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
input.input.button.is-warning(type='submit', value=`Log in as ${user._id}`, style='margin-top: 1em;')
|
2020-10-30 08:15:00 -07:00
|
|
|
h2(style='margin-bottom: 1em;') Reset Password
|
|
|
|
if user.pwToken
|
|
|
|
- const resetLink = `${_CC.config.base}resetpw/${user.pwToken}`
|
|
|
|
p There is a reset password link for this user.
|
|
|
|
if user.pwExpiry > new Date().getTime()
|
|
|
|
span It expires #{_CC.require('moment')(user.pwExpiry).fromNow()}
|
|
|
|
else
|
|
|
|
span.has-text-weight-bold.has-text-danger It expired #{_CC.require('moment')(user.pwExpiry).fromNow()}
|
|
|
|
a(href=resetLink)= resetLink
|
|
|
|
.columns
|
|
|
|
.column.is-narrow
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/resetpw/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
input.button.is-primary(type='submit' value='Refresh Password Reset Link')
|
|
|
|
.column.is-narrow
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/cancelresetpw/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
input.button.is-info(type='submit' value='Cancel Password Reset Link')
|
|
|
|
else
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/resetpw/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
input.button.is-danger(type='submit' value='Create Password Reset Link')
|
2020-10-29 20:50:36 -07:00
|
|
|
.column.is-narrow
|
|
|
|
h2 Irreversible Deletion
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/remove/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
if user.admin
|
|
|
|
input.button.is-danger(disabled, type='submit' value=`User is admin`)
|
|
|
|
else
|
|
|
|
input.button.is-danger(type='submit' value=`Remove user ${user._id}`)
|