From 9f67e66b83d158b99582c2984fc253b6e6abd537 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Thu, 1 May 2025 22:04:10 +0200 Subject: Simplify form post actions. 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. --- views/profile.pug | 65 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 41 insertions(+), 24 deletions(-) (limited to 'views/profile.pug') 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, #{user.name}! + + 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 ⚠ Verify your mail address! + if !mail.is_verified + p ⚠ Verify your mail address! p You must verify your mail address before you can enable notifications. else - if !user.notify - p Enable mail notifications - if user.notify - p Disable mail notifications + if !mail.notify + p Enable mail notifications + if mail.notify + p Disable mail notifications + else + p.error Mail notifications are disabled on this server. + + if ENABLE_WEBHOOKS + if !webhook + p Configure webhook + else if webhook.error + dl + dt Configure webhook + dd.error ERROR: #{webhook.error} + else + dl + dt Configure webhook + dd= new URL(webhook.url).hostname + else + p.error Webhook notifications are disabled on this server. + + h3 Account p - | Change password + | Change password br - | Change mail address + | Change mail address br - | Change user name + | Change user name br - | Change profile text - br - | Delete account + | Change profile text - if ENABLE_WEBHOOKS - if !user.webhook - p Configure webhook - else if user.webhook.error - dl - dt Configure webhook - dd.error ERROR: #{user.webhook.error} - else - dl - dt Configure webhook - dd= new URL(user.webhook.url).hostname + p + | Delete account p form(action="/logout" method="post") -- cgit v1.2.3