Add branding to email confirmation screen
This commit is contained in:
parent
f7e0c99764
commit
4e8918c1f3
1 changed files with 7 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
import { instrument } from 'succinct-async'
|
import { instrument } from 'succinct-async'
|
||||||
import express, { Request, Response, NextFunction } from 'express'
|
import express, { Request, Response, NextFunction } from 'express'
|
||||||
import rateLimit from 'express-rate-limit'
|
import rateLimit from 'express-rate-limit'
|
||||||
import { appSigner } from './env.js'
|
import { appSigner, BRAND_NAME, BRAND_ACCENT, BRAND_LOGO, EVENT_VIEWER_URL } from './env.js'
|
||||||
import { render } from './templates.js'
|
import { render } from './templates.js'
|
||||||
import { confirmSubscriptionAction, unsubscribeAction, registerSubscription, ActionError } from './actions.js'
|
import { confirmSubscriptionAction, unsubscribeAction, registerSubscription, ActionError } from './actions.js'
|
||||||
import { getSubscriptionById, insertEvent, getSubscriptionByKey, getSubscriptionByPubkey } from './database.js'
|
import { getSubscriptionById, insertEvent, getSubscriptionByKey, getSubscriptionByPubkey } from './database.js'
|
||||||
|
|
@ -198,7 +198,12 @@ addRoute('get', '/confirm', async (req: Request, res: Response) => {
|
||||||
try {
|
try {
|
||||||
await confirmSubscriptionAction({ token: req.query.token })
|
await confirmSubscriptionAction({ token: req.query.token })
|
||||||
|
|
||||||
res.send(await render('pages/confirm-success.html'))
|
res.send(await render('pages/confirm-success.html', {
|
||||||
|
brandName: BRAND_NAME,
|
||||||
|
brandAccent: BRAND_ACCENT,
|
||||||
|
brandLogo: BRAND_LOGO,
|
||||||
|
settingsUrl: `${EVENT_VIEWER_URL.replace(/\/$/, '')}/settings/alerts`,
|
||||||
|
}))
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
const isActionError = error instanceof ActionError
|
const isActionError = error instanceof ActionError
|
||||||
const message = isActionError ? String(error) : 'Oops, something went wrong on our end!'
|
const message = isActionError ? String(error) : 'Oops, something went wrong on our end!'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue