From 5dab1158e9d62bd1ebd12b97a7ba7a7a5bcd2368 Mon Sep 17 00:00:00 2001 From: ClaraCrazy Date: Wed, 2 Oct 2024 08:27:10 +0200 Subject: [PATCH] Fix errors found by elliot --- infrastructure/web/routes/inbox.js | 7 +++---- infrastructure/web/routes/login.js | 6 +++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/infrastructure/web/routes/inbox.js b/infrastructure/web/routes/inbox.js index f99f535..fe1493f 100644 --- a/infrastructure/web/routes/inbox.js +++ b/infrastructure/web/routes/inbox.js @@ -23,7 +23,7 @@ router.get('^/:address([^@/]+@[^@/]+)', sanitizeAddress, (req, res, _next) => { }) router.get( - '^/:address/:uid([0-9]+$)', + '^/:address/:uid([0-9]+)', sanitizeAddress, async (req, res, next) => { try { @@ -33,7 +33,6 @@ router.get( req.params.uid ) if (mail) { - // Set a default subject if none is present if (!mail.subject) { mail.subject = 'No Subject' @@ -102,7 +101,7 @@ router.get( ) router.get( - '^/:address/:uid/:checksum([a-f0-9]+$)', + '^/:address/:uid/:checksum([a-f0-9]+)', sanitizeAddress, async (req, res, next) => { try { @@ -155,8 +154,8 @@ router.get( req.params.uid, true ) - mail = mail.replace(/(?:\r\n|\r|\n)/g, '
') if (mail) { + mail = mail.replace(/(?:\r\n|\r|\n)/g, '
') // Emails are immutable, cache if found res.set('Cache-Control', 'private, max-age=600') res.render('raw', { diff --git a/infrastructure/web/routes/login.js b/infrastructure/web/routes/login.js index 4e61a46..df85a67 100644 --- a/infrastructure/web/routes/login.js +++ b/infrastructure/web/routes/login.js @@ -38,10 +38,10 @@ router.post( const errors = validationResult(req) if (!errors.isEmpty()) { return res.render('login', { - title: 'Login', - username: req.body.username, - domain: req.body.domain, userInputError: true, + title: `${config.http.branding[0]} | Your temporary Inbox`, + username: randomWord(), + domains: config.email.domains, madeby: config.http.branding[1], madebysite: config.http.branding[2] })