Fix errors found by elliot

pull/16/head
ClaraCrazy 2024-10-02 08:27:10 +02:00
parent 52452a7c8d
commit 5dab1158e9
No known key found for this signature in database
GPG Key ID: EBBC896ACB497011
2 changed files with 6 additions and 7 deletions

View File

@ -23,7 +23,7 @@ router.get('^/:address([^@/]+@[^@/]+)', sanitizeAddress, (req, res, _next) => {
}) })
router.get( router.get(
'^/:address/:uid([0-9]+$)', '^/:address/:uid([0-9]+)',
sanitizeAddress, sanitizeAddress,
async (req, res, next) => { async (req, res, next) => {
try { try {
@ -33,7 +33,6 @@ router.get(
req.params.uid req.params.uid
) )
if (mail) { if (mail) {
// Set a default subject if none is present // Set a default subject if none is present
if (!mail.subject) { if (!mail.subject) {
mail.subject = 'No Subject' mail.subject = 'No Subject'
@ -102,7 +101,7 @@ router.get(
) )
router.get( router.get(
'^/:address/:uid/:checksum([a-f0-9]+$)', '^/:address/:uid/:checksum([a-f0-9]+)',
sanitizeAddress, sanitizeAddress,
async (req, res, next) => { async (req, res, next) => {
try { try {
@ -155,8 +154,8 @@ router.get(
req.params.uid, req.params.uid,
true true
) )
mail = mail.replace(/(?:\r\n|\r|\n)/g, '<br>')
if (mail) { if (mail) {
mail = mail.replace(/(?:\r\n|\r|\n)/g, '<br>')
// Emails are immutable, cache if found // Emails are immutable, cache if found
res.set('Cache-Control', 'private, max-age=600') res.set('Cache-Control', 'private, max-age=600')
res.render('raw', { res.render('raw', {

View File

@ -38,10 +38,10 @@ router.post(
const errors = validationResult(req) const errors = validationResult(req)
if (!errors.isEmpty()) { if (!errors.isEmpty()) {
return res.render('login', { return res.render('login', {
title: 'Login',
username: req.body.username,
domain: req.body.domain,
userInputError: true, userInputError: true,
title: `${config.http.branding[0]} | Your temporary Inbox`,
username: randomWord(),
domains: config.email.domains,
madeby: config.http.branding[1], madeby: config.http.branding[1],
madebysite: config.http.branding[2] madebysite: config.http.branding[2]
}) })