mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Moved session verified check behind staff2fa flag
This commit is contained in:
parent
cb8d18423a
commit
3cffb9a132
1 changed files with 7 additions and 2 deletions
|
@ -42,8 +42,13 @@ function SessionMiddleware({sessionService}) {
|
||||||
async function authenticate(req, res, next) {
|
async function authenticate(req, res, next) {
|
||||||
try {
|
try {
|
||||||
const user = await sessionService.getUserForSession(req, res);
|
const user = await sessionService.getUserForSession(req, res);
|
||||||
|
if (user) {
|
||||||
|
if (labs.isSet('staff2fa')) {
|
||||||
const isVerified = await sessionService.isVerifiedSession(req, res);
|
const isVerified = await sessionService.isVerifiedSession(req, res);
|
||||||
if (user && isVerified) {
|
if (!isVerified) {
|
||||||
|
return next();
|
||||||
|
}
|
||||||
|
}
|
||||||
// Do not nullify `req.user` as it might have been already set
|
// Do not nullify `req.user` as it might have been already set
|
||||||
// in a previous middleware (authorize middleware).
|
// in a previous middleware (authorize middleware).
|
||||||
req.user = user;
|
req.user = user;
|
||||||
|
|
Loading…
Reference in a new issue