From a15503d7f4ca518f2537c24f1e4a1e7c10889093 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 26 Oct 2022 13:43:21 -0500 Subject: [PATCH 01/12] Redirect auth to profile if the user is logged in --- packages/marko-web-identity-x/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/marko-web-identity-x/index.js b/packages/marko-web-identity-x/index.js index 2b4eb80dd..1e98a9729 100644 --- a/packages/marko-web-identity-x/index.js +++ b/packages/marko-web-identity-x/index.js @@ -15,6 +15,13 @@ module.exports = (app, config, { config.endpointTypes.forEach((type) => { const endpoint = config.getEndpointFor(type); const template = templates[type]; - if (template) app.get(endpoint, (_, res) => res.marko(template)); + if (!template) return; + + app.get(endpoint, (req, res) => { + const { token } = req.identityX; + // Redirect to profile if a user token is already present (refresh after link click) + if (type === 'authenticate' && token) res.redirect(302, config.getEndpointFor('profile')); + res.marko(template); + }); }); }; From 1d3958e4e5b2de05787765a4f9fbc9677ece8082 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 26 Oct 2022 13:43:26 -0500 Subject: [PATCH 02/12] Fix inline form --- services/example-website/server/templates/index.marko | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/example-website/server/templates/index.marko b/services/example-website/server/templates/index.marko index 22a5d066e..26c7aa144 100644 --- a/services/example-website/server/templates/index.marko +++ b/services/example-website/server/templates/index.marko @@ -37,7 +37,7 @@ <@section>
- +
From c4f68ea5e1a233fb1db99208cc66312f261314db Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 26 Oct 2022 14:40:48 -0500 Subject: [PATCH 03/12] =?UTF-8?q?Load=20the=20active=20context=20when=20a?= =?UTF-8?q?=20user=20isn=E2=80=99t=20present?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/marko-web-identity-x/service.js | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/marko-web-identity-x/service.js b/packages/marko-web-identity-x/service.js index b23f9c3c5..4c14f82b4 100644 --- a/packages/marko-web-identity-x/service.js +++ b/packages/marko-web-identity-x/service.js @@ -47,10 +47,7 @@ class IdentityX { * * @returns {Promise} */ - async loadActiveContext({ forceQuery = false, useIps = false } = {}) { - // Require a token/cookie to check active context. This disables team context from IP/CIDR. - if (!this.token && !useIps) return {}; - + async loadActiveContext({ forceQuery = false } = {}) { // Only run the active context query once if (!this.activeContextQuery || forceQuery) { this.activeContextQuery = this.client.query({ query: getActiveContext }); From 5cfb8eb30103811deea651bb6586646286c89396 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 26 Oct 2022 14:47:49 -0500 Subject: [PATCH 04/12] Remove failing onLogout hook Resolves errors introduced in #439 --- .../add-integration-hooks.js | 15 --------------- .../integration-hooks/index.js | 2 -- .../integration-hooks/on-logout.js | 1 - 3 files changed, 18 deletions(-) delete mode 100644 packages/marko-web-omeda-identity-x/integration-hooks/on-logout.js diff --git a/packages/marko-web-omeda-identity-x/add-integration-hooks.js b/packages/marko-web-omeda-identity-x/add-integration-hooks.js index d5a702d3f..962f271c4 100644 --- a/packages/marko-web-omeda-identity-x/add-integration-hooks.js +++ b/packages/marko-web-omeda-identity-x/add-integration-hooks.js @@ -8,7 +8,6 @@ const props = require('./validation/props'); const { onAuthenticationSuccess, onLoginLinkSent, - onLogout, onUserProfileUpdate, } = require('./integration-hooks'); @@ -114,19 +113,5 @@ module.exports = (params = {}) => { }), }); - idxConfig.addHook({ - name: 'onLogout', - shouldAwait: true, - fn: async args => onLogout({ - ...args, - ...appendDataFor('onLogout'), - behavior: buildBehaviorFor('onLogout', { - actionSource: get(args, 'actionSource'), - newsletterSignupType: get(args, 'newsletterSignupType'), - contentGateType: get(args, 'contentGateType'), - }), - }), - }); - return idxConfig; }; diff --git a/packages/marko-web-omeda-identity-x/integration-hooks/index.js b/packages/marko-web-omeda-identity-x/integration-hooks/index.js index 9f97cb042..ab7d7b304 100644 --- a/packages/marko-web-omeda-identity-x/integration-hooks/index.js +++ b/packages/marko-web-omeda-identity-x/integration-hooks/index.js @@ -1,11 +1,9 @@ const onAuthenticationSuccess = require('./on-authentication-success'); const onLoginLinkSent = require('./on-login-link-sent'); -const onLogout = require('./on-logout'); const onUserProfileUpdate = require('./on-user-profile-update'); module.exports = { onAuthenticationSuccess, onLoginLinkSent, - onLogout, onUserProfileUpdate, }; diff --git a/packages/marko-web-omeda-identity-x/integration-hooks/on-logout.js b/packages/marko-web-omeda-identity-x/integration-hooks/on-logout.js deleted file mode 100644 index f053ebf79..000000000 --- a/packages/marko-web-omeda-identity-x/integration-hooks/on-logout.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; From d8b2a893a849986e40b75e96aec65b729a5bd2b0 Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 26 Oct 2022 15:30:09 -0500 Subject: [PATCH 05/12] Revert example customizations --- .../server/components/document.marko | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/example-website/server/components/document.marko b/services/example-website/server/components/document.marko index 97ed68cd6..4fdf94043 100644 --- a/services/example-website/server/components/document.marko +++ b/services/example-website/server/components/document.marko @@ -44,7 +44,12 @@ $ const { nativeX } = out.global; <@above-container> - + @@ -53,11 +58,7 @@ $ const { nativeX } = out.global; <@below-container> <${input.belowContainer} /> - - <@newsletter-block> - - - + From db9ce59c48c3151b334f672ec42080aec056e02f Mon Sep 17 00:00:00 2001 From: Josh Worden Date: Wed, 26 Oct 2022 15:31:14 -0500 Subject: [PATCH 06/12] Display email consent and consent policy on login --- packages/marko-web-identity-x/browser/login.vue | 13 ++++++++++++- packages/marko-web-identity-x/browser/profile.vue | 2 +- .../components/form-login.marko | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/marko-web-identity-x/browser/login.vue b/packages/marko-web-identity-x/browser/login.vue index e4da0a499..e03367f29 100644 --- a/packages/marko-web-identity-x/browser/login.vue +++ b/packages/marko-web-identity-x/browser/login.vue @@ -36,9 +36,16 @@ :disabled="loading" :label="loginEmailLabel" /> + + +