Alte Mail-Links aufs Admin-Panel leiten ins Ticketsystem (Antrag direkt geoeffnet)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95e2807dc7
commit
df8b952b81
3 files changed
+47
-1
No files matched your search
@@ -0,0 +1,21 @@
|
||||
import { config } from '../config.js'
|
||||
|
||||
/**
|
||||
* Admin-Panel (/admin.html) und Rechnungsanalyse (/kalkulation.html) sind abgeschaltet (Etappe 4). Links aus
|
||||
* aelteren Team-Mails fuehren ins Ticketsystem; /admin.html?gutschrift=<id> oeffnet den Antrag unter
|
||||
* Kunden -> Gutschriften.
|
||||
*/
|
||||
const ANTRAG_ID = /^[A-Za-z0-9._-]{1,64}$/
|
||||
|
||||
const toTicketsystem = (pathFor) => (req, res, next) => {
|
||||
if (req.method !== 'GET' && req.method !== 'HEAD') return next()
|
||||
return res.redirect(302, `${config.womsBaseUrl}${pathFor(req)}`)
|
||||
}
|
||||
|
||||
export default {
|
||||
admin: toTicketsystem((req) => {
|
||||
const antrag = typeof req.query.gutschrift === 'string' ? req.query.gutschrift : ''
|
||||
return ANTRAG_ID.test(antrag) ? `/customers/gutschriften?antrag=${encodeURIComponent(antrag)}` : '/customers'
|
||||
}),
|
||||
kalkulation: toTicketsystem(() => '/customers'),
|
||||
}
|
||||
Reference in new issue
Block a user