diff --git a/demo/collections/Admin.js b/demo/collections/Admin.js index 5c6faf3fa5..691b2d241d 100644 --- a/demo/collections/Admin.js +++ b/demo/collections/Admin.js @@ -23,6 +23,7 @@ module.exports = { tokenExpiration: 7200, useAPIKey: true, secureCookie: process.env.NODE_ENV === 'production', + sameSite: false, // 'strict', 'lax', 'none', true (strict) }, fields: [ { diff --git a/demo/custom-index.html b/demo/custom-index.html new file mode 100644 index 0000000000..5308bf84eb --- /dev/null +++ b/demo/custom-index.html @@ -0,0 +1,15 @@ + + + + + + + + + + +
+
+ + + diff --git a/demo/payload.config.js b/demo/payload.config.js index c369e85223..fe45890a20 100644 --- a/demo/payload.config.js +++ b/demo/payload.config.js @@ -28,8 +28,9 @@ const GlobalWithStrictAccess = require('./globals/GlobalWithStrictAccess'); module.exports = { admin: { user: 'admins', + // indexHTML: path.resolve(__dirname, 'custom-index.html'), meta: { - titleSuffix: '- Payload', + titleSuffix: '- Payload Demo', ogImage: '/static/find-image-here.jpg', favicon: '/img/whatever.png', }, @@ -40,10 +41,6 @@ module.exports = { }, }, }, - csrf: [ - 'http://localhost:3000', - 'https://other-app-here.com', - ], collections: [ Admin, AllFields, @@ -75,6 +72,10 @@ module.exports = { cookiePrefix: 'payload', serverURL: 'http://localhost:3000', cors: ['http://localhost', 'http://localhost:3000', 'http://localhost:8080', 'http://localhost:8081'], + csrf: [ + 'http://localhost:3000', + 'https://other-app-here.com', + ], routes: { api: '/api', admin: '/admin', diff --git a/package.json b/package.json index 1d699dbc31..0a83200a4c 100644 --- a/package.json +++ b/package.json @@ -94,6 +94,7 @@ "react-datepicker": "^2.13.0", "react-document-meta": "^3.0.0-beta.2", "react-dom": "^16.13.1", + "react-helmet": "^6.1.0", "react-hook-form": "^5.7.2", "react-router-dom": "^5.1.2", "react-router-navigation-prompt": "^1.8.11", diff --git a/src/auth/operations/login.js b/src/auth/operations/login.js index 5a0da4c224..90ef276db9 100644 --- a/src/auth/operations/login.js +++ b/src/auth/operations/login.js @@ -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://', ''); diff --git a/src/client/components/templates/Default/index.js b/src/client/components/templates/Default/index.js index 7c5ebfb3ad..d2df2164f7 100644 --- a/src/client/components/templates/Default/index.js +++ b/src/client/components/templates/Default/index.js @@ -3,6 +3,7 @@ import PropTypes from 'prop-types'; import DefaultNav from '../../elements/Nav'; import { StepNavProvider } from '../../elements/StepNav'; import customComponents from '../../customComponents'; +import Meta from '../../utilities/Meta'; import './index.scss'; @@ -19,6 +20,11 @@ const Default = ({ children, className }) => { return (
+