2025-03-05 15:04:27 +01:00
|
|
|
const profileServiceProvider = require('../services/profileService');
|
|
|
|
|
const ContactDetailsSet = require('../models/ContactDetailsSet');
|
|
|
|
|
const NymSet = require('../models/NymSet');
|
|
|
|
|
const profileService = profileServiceProvider(ContactDetailsSet, NymSet);
|
2025-02-20 23:45:13 +01:00
|
|
|
|
|
|
|
|
async function redirectIfMissingProfileDetailsMiddleware(req, res, next) {
|
|
|
|
|
const publicKey = req.cookies.publicKey;
|
|
|
|
|
if (!(await profileService.areProfileDetailsComplete(publicKey))) {
|
|
|
|
|
res.redirect('/createProfile');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
module.exports = redirectIfMissingProfileDetailsMiddleware;
|