fix(passwordless): Reduce db calls, run in parallel
Adds validations, reduces the number of database calls, separates concers. reduces logic
This commit is contained in:
committed by
mrugesh mohapatra
parent
44c2eb65d5
commit
750c9f1eab
@@ -43,3 +43,13 @@ export function ifNotVerifiedRedirectToSettings(req, res, next) {
|
||||
}
|
||||
return next();
|
||||
}
|
||||
|
||||
export function ifUserRedirectTo(path = '/', status) {
|
||||
status = status === 302 ? 302 : 301;
|
||||
return (req, res, next) => {
|
||||
if (req.user) {
|
||||
return res.status(status).redirect(path);
|
||||
}
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user