2020-10-29 20:50:36 -07:00
|
|
|
extends layout.pug
|
|
|
|
|
|
|
|
block title
|
|
|
|
h1(style="margin-bottom: 0;")
|
|
|
|
a(href='..') <
|
|
|
|
| #{config.siteTitle}
|
2021-12-03 08:13:43 -08:00
|
|
|
p= lang('ADMIN_USER_EDIT_EDITING_USER', user._id)
|
2020-10-29 20:50:36 -07:00
|
|
|
|
|
|
|
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;')
|
2021-12-03 08:13:43 -08:00
|
|
|
h2= lang('ADMIN_USER_EDIT_CONFIRMATION_LINK')
|
2020-10-29 20:50:36 -07:00
|
|
|
.column(style='padding-bottom: 0;')
|
|
|
|
p
|
2021-12-03 08:13:43 -08:00
|
|
|
span= lang('ADMIN_USER_EDIT_ACCOUNT_UNCONFIRMED')
|
2020-10-29 20:50:36 -07:00
|
|
|
br
|
|
|
|
if user.expiry > new Date().getTime()
|
2021-12-03 08:13:43 -08:00
|
|
|
span= lang('ADMIN_USER_EDIT_LINK_EXPIRY_FUTURE', _CC.moment(user.expiry).fromNow())
|
2020-10-29 20:50:36 -07:00
|
|
|
else
|
2021-12-03 08:13:43 -08:00
|
|
|
span.has-text-weight-bold(style='color: red;')= lang('ADMIN_USER_EDIT_LINK_EXPIRY_PAST', _CC.moment(user.expiry).fromNow())
|
2020-10-29 20:50:36 -07:00
|
|
|
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}`)
|
2021-12-03 08:13:43 -08:00
|
|
|
input.button.is-rounded(type='submit', value=lang('ADMIN_USER_EDIT_GENERATE_NEW_LINK'))
|
2020-10-29 20:50:36 -07:00
|
|
|
.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
|
2021-12-03 08:13:43 -08:00
|
|
|
h2= lang('ADMIN_USER_EDIT_CHANGE_NAME')
|
2020-11-03 17:25:20 -08:00
|
|
|
form(action=`${_CC.config.base}admin-settings/edit/rename/${user._id}`, method='POST')
|
|
|
|
.field
|
2021-12-03 08:13:43 -08:00
|
|
|
label.label= lang('ADMIN_USER_EDIT_USERNAME')
|
2020-11-03 17:25:20 -08:00
|
|
|
.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
|
2021-12-03 08:13:43 -08:00
|
|
|
input.button.is-primary(type='submit' value=lang('ADMIN_USER_EDIT_CHANGE_USERNAME'))
|
2020-11-03 17:25:20 -08:00
|
|
|
.column.is-narrow
|
2021-12-03 08:13:43 -08:00
|
|
|
h2= lang('ADMIN_USER_EDIT_ADMIN')
|
2021-01-02 14:07:07 -08:00
|
|
|
//- 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
|
2021-12-03 08:13:43 -08:00
|
|
|
p.is-marginless= lang('ADMIN_USER_EDIT_ADMIN_ISADMIN', user._id)
|
2021-01-02 14:07:07 -08:00
|
|
|
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
|
2021-12-03 08:13:43 -08:00
|
|
|
input.input.button(disabled, type='submit', value=lang('ADMIN_USER_EDIT_DEMOTE_SELF'), style='margin-top: 1em;')
|
2021-01-02 14:07:07 -08:00
|
|
|
else
|
2021-12-03 08:13:43 -08:00
|
|
|
input.input.button(type='submit', value=lang('ADMIN_USER_EDIT_DEMOTE', user._id), style='margin-top: 1em;')
|
2021-01-02 14:07:07 -08:00
|
|
|
else
|
2021-12-03 08:13:43 -08:00
|
|
|
p.is-marginless= lang('ADMIN_USER_EDIT_ADMIN_NOTADMIN', user._id)
|
2021-01-02 14:07:07 -08:00
|
|
|
form(action=`${_CC.config.base}admin-settings/edit/promote/${user._id}`, method='POST')
|
|
|
|
.field
|
|
|
|
.control
|
2021-12-03 08:13:43 -08:00
|
|
|
input.input.button(type='submit', value=lang('ADMIN_USER_EDIT_PROMOTE', user._id), style='margin-top: 1em;')
|
2021-01-02 14:07:07 -08:00
|
|
|
if user._id !== req.user._id
|
|
|
|
.column.is-narrow
|
2021-12-03 08:13:43 -08:00
|
|
|
h2= lang('ADMIN_USER_EDIT_IMPERSONATE_HEADER')
|
2021-01-02 14:07:07 -08:00
|
|
|
form(action=`${_CC.config.base}admin-settings/edit/impersonate/${user._id}`, method='POST')
|
|
|
|
.field
|
|
|
|
.control
|
2021-12-03 08:13:43 -08:00
|
|
|
input.input.button.is-warning(type='submit', value=lang('ADMIN_USER_EDIT_IMPERSONATE_BUTTON', user._id), style='margin-top: 1em;')
|
|
|
|
h2(style='margin-bottom: 1em;')= lang('ADMIN_USER_EDIT_RESET_PASSWORD_HEADER')
|
2020-10-30 08:15:00 -07:00
|
|
|
if user.pwToken
|
|
|
|
- const resetLink = `${_CC.config.base}resetpw/${user.pwToken}`
|
2021-12-03 08:13:43 -08:00
|
|
|
p= lang('ADMIN_USER_EDIT_RESET_PASSWORD_HASLINK')
|
2020-10-30 08:15:00 -07:00
|
|
|
if user.pwExpiry > new Date().getTime()
|
2021-12-03 08:13:43 -08:00
|
|
|
span= lang('ADMIN_USER_EDIT_RESET_PASSWORD_HASLINK_EXPIRY_FUTURE', _CC.moment(user.pwExpiry).fromNow())
|
2020-10-30 08:15:00 -07:00
|
|
|
else
|
2021-12-03 08:13:43 -08:00
|
|
|
span.has-text-weight-bold.has-text-danger= lang('ADMIN_USER_EDIT_RESET_PASSWORD_HASLINK_EXPIRY_PAST', _CC.moment(user.pwExpiry).fromNow())
|
2020-10-30 08:15:00 -07:00
|
|
|
a(href=resetLink)= resetLink
|
|
|
|
.columns
|
|
|
|
.column.is-narrow
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/resetpw/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
2021-12-03 08:13:43 -08:00
|
|
|
input.button.is-primary(type='submit' value=lang('ADMIN_USER_EDIT_RESET_PASSWORD_LINK_REFRESH'))
|
2020-10-30 08:15:00 -07:00
|
|
|
.column.is-narrow
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/cancelresetpw/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
2021-12-03 08:13:43 -08:00
|
|
|
input.button.is-info(type='submit' value=lang('ADMIN_USER_EDIT_RESET_PASSWORD_LINK_CANCEL'))
|
2020-10-30 08:15:00 -07:00
|
|
|
else
|
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/resetpw/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
2021-12-03 08:13:43 -08:00
|
|
|
input.button.is-danger(type='submit' value=lang('ADMIN_USER_EDIT_RESET_PASSWORD_LINK_CREATE'))
|
2020-10-29 20:50:36 -07:00
|
|
|
.column.is-narrow
|
2021-12-03 08:13:43 -08:00
|
|
|
h2= lang('ADMIN_USER_EDIT_DELETE_HEADER')
|
2020-10-29 20:50:36 -07:00
|
|
|
form(method='POST', action=`${_CC.config.base}admin-settings/edit/remove/${user._id}`)
|
|
|
|
.field
|
|
|
|
.control
|
|
|
|
if user.admin
|
2021-12-03 08:13:43 -08:00
|
|
|
input.button.is-danger(disabled, type='submit' value=lang('ADMIN_USER_EDIT_DELETE_ADMIN'))
|
2020-10-29 20:50:36 -07:00
|
|
|
else
|
2021-12-03 08:13:43 -08:00
|
|
|
input.button.is-danger(type='submit' value=lang('ADMIN_USER_EDIT_DELETE_USER', user._id))
|