add samesite config setting to auth

This commit is contained in:
Dan Ribbens
2020-08-22 00:08:46 -04:00
parent 74ac23dbc6
commit 9ef9cca948
3 changed files with 9 additions and 4 deletions

View File

@@ -96,6 +96,10 @@ async function login(args) {
cookieOptions.secure = true;
}
if (collectionConfig.auth.sameSite) {
cookieOptions.sameSite = collectionConfig.auth.sameSite;
}
if (args.req.headers && args.req.headers.origin && args.req.headers.origin.indexOf('localhost') === -1) {
let domain = args.req.headers.origin.replace('https://', '');
domain = domain.replace('http://', '');