summaryrefslogtreecommitdiff
path: root/views/profile.pug
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2025-05-01 22:04:10 +0200
committerTor Andersson <tor@ccxvii.net>2025-05-12 00:21:06 +0200
commit9f67e66b83d158b99582c2984fc253b6e6abd537 (patch)
tree9ccd06c22afdafa4607c012f4b99deeb0b87a3c8 /views/profile.pug
parent1eaa2ef7ca02e1534ba5f1baefdc794f675065e0 (diff)
downloadserver-9f67e66b83d158b99582c2984fc253b6e6abd537.tar.gz
Simplify form post actions.HEADmaster
Put account management pages under "/account" URL prefix. Set logged in user in res.locals for use in pug templates. Tweak verification flow. Require password to change name and mail. Show user statistics on profile (use pug mixin). Remove "api" prefix on many routes.
Diffstat (limited to 'views/profile.pug')
-rw-r--r--views/profile.pug65
1 files changed, 41 insertions, 24 deletions
diff --git a/views/profile.pug b/views/profile.pug
index 4ecf289..fc9a1d3 100644
--- a/views/profile.pug
+++ b/views/profile.pug
@@ -7,43 +7,60 @@ html
body
include header
article
- h1= SITE_NAME
+ h1 Profile
p Welcome, <a class="black" href="/user/#{user.name}">#{user.name}</a>!
+
+ if who.about
+ p.box= who.about
+
+ p Member since #{human_date(who.ctime)}.
+
+ +userstats(who, ratings)
+
+ h3 Notifications
+
p Your mail address is #{user.mail}
if ENABLE_MAIL
- if !user.is_verified
- p &#x26a0; <a href="/verify-mail">Verify your mail address!</a>
+ if !mail.is_verified
+ p &#x26a0; <a href="/account/mail/verify">Verify your mail address!</a>
p You must verify your mail address before you can enable notifications.
else
- if !user.notify
- p <a href="/subscribe">Enable mail notifications</a>
- if user.notify
- p <a href="/unsubscribe">Disable mail notifications</a>
+ if !mail.notify
+ p <a href="/account/mail/subscribe">Enable mail notifications</a>
+ if mail.notify
+ p <a href="/account/mail/unsubscribe">Disable mail notifications</a>
+ else
+ p.error Mail notifications are disabled on this server.
+
+ if ENABLE_WEBHOOKS
+ if !webhook
+ p <a href="/account/webhook">Configure webhook</a>
+ else if webhook.error
+ dl
+ dt <a href="/account/webhook">Configure webhook</a>
+ dd.error ERROR: #{webhook.error}
+ else
+ dl
+ dt <a href="/account/webhook">Configure webhook</a>
+ dd= new URL(webhook.url).hostname
+ else
+ p.error Webhook notifications are disabled on this server.
+
+ h3 Account
p
- | <a href="/change-password">Change password</a>
+ | <a href="/account/change-password">Change password</a>
br
- | <a href="/change-mail">Change mail address</a>
+ | <a href="/account/change-mail">Change mail address</a>
br
- | <a href="/change-name">Change user name</a>
+ | <a href="/account/change-name">Change user name</a>
br
- | <a href="/change-about">Change profile text</a>
- br
- | <a href="/delete-account">Delete account</a>
+ | <a href="/account/change-about">Change profile text</a>
- if ENABLE_WEBHOOKS
- if !user.webhook
- p <a href="/webhook">Configure webhook</a>
- else if user.webhook.error
- dl
- dt <a href="/webhook">Configure webhook</a>
- dd.error ERROR: #{user.webhook.error}
- else
- dl
- dt <a href="/webhook">Configure webhook</a>
- dd= new URL(user.webhook.url).hostname
+ p
+ | <a href="/account/delete">Delete account</a>
p
form(action="/logout" method="post")