automatically generate example inbox url

This commit is contained in:
ClaraCrazy 2025-12-07 15:19:23 +01:00
parent e158fac414
commit 9d991486ae
No known key found for this signature in database
GPG key ID: EBBC896ACB497011
3 changed files with 36 additions and 36 deletions

View file

@ -1,6 +1,6 @@
const express = require('express') const express = require('express')
const router = new express.Router() const router = new express.Router()
const {check, validationResult} = require('express-validator') const { check, validationResult } = require('express-validator')
const randomWord = require('random-word') const randomWord = require('random-word')
const config = require('../../../application/config') const config = require('../../../application/config')
@ -16,6 +16,7 @@ router.get('/', (req, res, _next) => {
purgeTime: purgeTime, purgeTime: purgeTime,
domains: helper.getDomains(), domains: helper.getDomains(),
branding: config.http.branding, branding: config.http.branding,
example: config.email.examples.account,
}) })
}) })
@ -33,9 +34,8 @@ router.get('/logout', (req, res, _next) => {
}) })
router.post( router.post(
'/', '/', [
[ check('username').isLength({ min: 1 }),
check('username').isLength({min: 1}),
check('domain').isIn(config.email.domains) check('domain').isIn(config.email.domains)
], ],
(req, res) => { (req, res) => {

View file

@ -3,7 +3,7 @@
{% block body %} {% block body %}
<div style="float: right; text-align: end;"> <div style="float: right; text-align: end;">
<a href="/inbox/example@48hr.email">Example Inbox</a> <a href="/inbox/{{ example }}">Example Inbox</a>
</div> </div>
<div id="login"> <div id="login">
<h1>Welcome!</h1> <h1>Welcome!</h1>

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{ {
"name": "48hr.email", "name": "48hr.email",
"version": "1.5.4", "version": "1.6.1",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "48hr.email", "name": "48hr.email",
"version": "1.5.4", "version": "1.6.1",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"array.prototype.flatmap": "^1.3.2", "array.prototype.flatmap": "^1.3.2",