7e89950358
- feat(logging): log all http requests and responses - the auto logger does not log the body, to ensure sensitive payloads are not logged. Unfortunately this means that error messages are not logged either, so need to be manually logged. - fix(logging): 400 errors should be info not error severity logging
21 lines
694 B
JavaScript
21 lines
694 B
JavaScript
const { EmailVerificationFinalizationError } = require('@/modules/emails/errors')
|
|
const {
|
|
finalizeEmailVerification
|
|
} = require('@/modules/emails/services/verification/finalize')
|
|
|
|
module.exports = (app) => {
|
|
app.get('/auth/verifyemail', async (req, res) => {
|
|
try {
|
|
await finalizeEmailVerification(req.query.t)
|
|
return res.redirect('/?emailverifiedstatus=true')
|
|
} catch (error) {
|
|
const msg =
|
|
error instanceof EmailVerificationFinalizationError
|
|
? error.message
|
|
: 'Email verification unexpectedly failed'
|
|
req.log.info({ err: error }, 'Email verification failed.')
|
|
return res.redirect(`/?emailverifiederror=${msg}`)
|
|
}
|
|
})
|
|
}
|