fix: remove cookies when signout, logout (remote) and delete (remote)
This commit is contained in:
@ -407,10 +407,15 @@ module.exports = function(User) {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
User.afterRemote('logout', function(ctx, result, next) {
|
User.afterRemote('logout', function({req, res}, result, next) {
|
||||||
var res = ctx.res;
|
const config = {
|
||||||
res.clearCookie('access_token');
|
signed: !!req.signedCookies,
|
||||||
res.clearCookie('userId');
|
domain: process.env.COOKIE_DOMAIN || 'localhost'
|
||||||
|
};
|
||||||
|
res.clearCookie('jwt_access_token', config);
|
||||||
|
res.clearCookie('access_token', config);
|
||||||
|
res.clearCookie('userId', config);
|
||||||
|
res.clearCookie('_csrf', config);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -59,10 +59,14 @@ module.exports = function enableAuthentication(app) {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
res.clearCookie('jwt_access_token');
|
const config = {
|
||||||
res.clearCookie('access_token');
|
signed: !!req.signedCookies,
|
||||||
res.clearCookie('userId');
|
domain: process.env.COOKIE_DOMAIN || 'localhost'
|
||||||
res.clearCookie('_csrf');
|
};
|
||||||
|
res.clearCookie('jwt_access_token', config);
|
||||||
|
res.clearCookie('access_token', config);
|
||||||
|
res.clearCookie('userId', config);
|
||||||
|
res.clearCookie('_csrf', config);
|
||||||
res.redirect('/');
|
res.redirect('/');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -119,10 +119,14 @@ module.exports = function(app) {
|
|||||||
if (err) { return next(err); }
|
if (err) { return next(err); }
|
||||||
req.logout();
|
req.logout();
|
||||||
req.flash('success', 'You have successfully deleted your account.');
|
req.flash('success', 'You have successfully deleted your account.');
|
||||||
res.clearCookie('jwt_access_token');
|
const config = {
|
||||||
res.clearCookie('access_token');
|
signed: !!req.signedCookies,
|
||||||
res.clearCookie('userId');
|
domain: process.env.COOKIE_DOMAIN || 'localhost'
|
||||||
res.clearCookie('_csrf');
|
};
|
||||||
|
res.clearCookie('jwt_access_token', config);
|
||||||
|
res.clearCookie('access_token', config);
|
||||||
|
res.clearCookie('userId', config);
|
||||||
|
res.clearCookie('_csrf', config);
|
||||||
return res.status(200).end();
|
return res.status(200).end();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user