diff --git a/server/auth-router.js b/server/auth-router.js index 9b871bf7c9..00d5a018fb 100644 --- a/server/auth-router.js +++ b/server/auth-router.js @@ -135,6 +135,11 @@ export default function authRouter(config = {}) { options.login_hint = 'signUp'; } + // Guest Username + if (req.query.username) { + options.username = req.query.username; + } + info(`LoginUI: attempt login, session id:${req.sessionID}, cookie:${getSyncCookie(req)}, done url:${req.query.doneUrl}`); // eslint-disable-line max-len passport.authenticate('auth0', options)(req, res, next); }); diff --git a/src/components/Checkout/CheckoutDropInPaymentWrapper.vue b/src/components/Checkout/CheckoutDropInPaymentWrapper.vue index 4b9b07263f..025efdb4b8 100644 --- a/src/components/Checkout/CheckoutDropInPaymentWrapper.vue +++ b/src/components/Checkout/CheckoutDropInPaymentWrapper.vue @@ -455,7 +455,7 @@ export default { transactionId ); // Complete transaction handles additional analytics + redirect - this.$emit('complete-transaction', transactionId); + this.$emit('complete-transaction', { transactionId, username: this.email }); } }, handleFailedCheckout(kivaBraintreeResponse) { diff --git a/src/components/Forms/GuestAccountCreation.vue b/src/components/Forms/GuestAccountCreation.vue index f01ef72f7a..e5b0941a69 100644 --- a/src/components/Forms/GuestAccountCreation.vue +++ b/src/components/Forms/GuestAccountCreation.vue @@ -86,7 +86,11 @@ export default { eventValue: { type: Number, default: 0 - } + }, + guestUsername: { + type: String, + default: '' + }, }, data() { return { @@ -129,10 +133,14 @@ export default { if (result?.errors?.length > 0) { throw result.errors; } - const resetUrl = result?.data?.general?.startGuestAccountClaim; + let resetUrl = result?.data?.general?.startGuestAccountClaim; if (!resetUrl) { throw new Error('Missing reset url'); } + if (this.guestUsername) { + resetUrl += `&username=${this.guestUsername}`; + } + window.location = resetUrl; }).catch(err => { this.serverError = true; diff --git a/src/components/Thanks/CommentAsk.vue b/src/components/Thanks/CommentAsk.vue index 06b4645aff..e73605e239 100644 --- a/src/components/Thanks/CommentAsk.vue +++ b/src/components/Thanks/CommentAsk.vue @@ -112,7 +112,9 @@

- +
@@ -155,6 +157,10 @@ export default { type: Boolean, default: false }, + guestUsername: { + type: String, + default: '', + }, }, data() { return { diff --git a/src/components/Thanks/MyKiva/ThanksBadges.vue b/src/components/Thanks/MyKiva/ThanksBadges.vue index 46581b4207..f7cac99424 100644 --- a/src/components/Thanks/MyKiva/ThanksBadges.vue +++ b/src/components/Thanks/MyKiva/ThanksBadges.vue @@ -163,6 +163,7 @@ event-label="create-new-account" event-property="guest" :event-value="numberOfBadges" + :guest-username="guestUsername" /> @@ -226,6 +227,10 @@ const props = defineProps({ type: Object, default: () => ({}), }, + guestUsername: { + type: String, + default: '', + }, }); const { diff --git a/src/components/Thanks/SingleVersion/AccountReceiptShare.vue b/src/components/Thanks/SingleVersion/AccountReceiptShare.vue index 134dfdac06..17c60e9f09 100644 --- a/src/components/Thanks/SingleVersion/AccountReceiptShare.vue +++ b/src/components/Thanks/SingleVersion/AccountReceiptShare.vue @@ -30,6 +30,7 @@ event-label="create-new-account-from-drawer" :event-property="userType" :event-value="numberOfBadges" + :guest-username="guestUsername" /> @@ -131,6 +132,10 @@ const props = defineProps({ type: Boolean, default: false, }, + guestUsername: { + type: String, + default: '' + }, }); const POST_CHECKOUT_EVENT_CATEGORY = 'post-checkout'; diff --git a/src/components/Thanks/ThanksPageCommentAndShare.vue b/src/components/Thanks/ThanksPageCommentAndShare.vue index 5af69d9800..95607ae411 100644 --- a/src/components/Thanks/ThanksPageCommentAndShare.vue +++ b/src/components/Thanks/ThanksPageCommentAndShare.vue @@ -114,6 +114,7 @@ :loan-name="loan.name" :loan-id="loan.id" :is-guest="isGuest" + :guest-username="guestUsername" /> @@ -273,6 +274,10 @@ export default { type: Boolean, default: false, }, + guestUsername: { + type: String, + default: '', + }, }, mixins: [socialSharingMixin], head() { diff --git a/src/components/Thanks/ThanksPageSingleVersion.vue b/src/components/Thanks/ThanksPageSingleVersion.vue index 82ef69f614..d8471a1cdd 100644 --- a/src/components/Thanks/ThanksPageSingleVersion.vue +++ b/src/components/Thanks/ThanksPageSingleVersion.vue @@ -58,6 +58,7 @@ :loans="loans" :show-receipt="showReceipt" :only-donations="onlyDonations" + :guest-username="guestUsername" /> @@ -131,7 +133,11 @@ const props = defineProps({ myKivaEnabled: { type: Boolean, default: false, - } + }, + guestUsername: { + type: String, + default: '', + }, }); const receiptSection = ref(null); diff --git a/src/components/Thanks/WhatIsNextTemplate.vue b/src/components/Thanks/WhatIsNextTemplate.vue index f9cce382b4..29caab109b 100644 --- a/src/components/Thanks/WhatIsNextTemplate.vue +++ b/src/components/Thanks/WhatIsNextTemplate.vue @@ -85,6 +85,7 @@ class="tw-pt-3 account-creation" event-category="thanks" event-label="open-account-creation-drawer" + :guest-username="guestUsername" />
@@ -164,6 +167,7 @@ :ftd-credit-amount="ftdCreditAmount" @guest-create-account="createGuestAccount" :ask-for-comments="askForComments" + :guest-username="guestUsername" /> @@ -291,6 +295,7 @@ export default { badgesAchieved: [], thanksSingleVersionEnabled: false, SINGLE_VERSION_VIEW, + guestUsername: '', }; }, apollo: { @@ -612,6 +617,7 @@ export default { this.enableMayChallengeHeader = shareChallengeExpData?.version === 'b'; this.optedIn = data?.my?.communicationSettings?.lenderNews || this.$route.query?.optedIn === 'true'; + this.guestUsername = this.$route.query?.username ?? ''; // MyKiva Badges Experiment this.myKivaExperimentEnabled = getIsMyKivaEnabled(