don't allow going home unless profile details are complete

This commit is contained in:
counterweight 2025-02-20 23:45:13 +01:00
parent c38feef86f
commit f57a20a3a3
Signed by: counterweight
GPG key ID: 883EDBAA726BD96C
3 changed files with 26 additions and 23 deletions

View file

@ -0,0 +1,12 @@
const profileService = require('../services/profileService');
async function redirectIfMissingProfileDetailsMiddleware(req, res, next) {
const publicKey = req.cookies.publicKey;
if (!(await profileService.areProfileDetailsComplete(publicKey))) {
res.redirect('/createProfile');
}
next();
}
module.exports = redirectIfMissingProfileDetailsMiddleware;