-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vue-demo): double opt in registration (#1489)
* fix(vue-demo): double opt in registration * fix: changes after CR * feat(vue-demo): add confirmation page * chore: remove svgs --------- Co-authored-by: patzick <[email protected]>
- Loading branch information
1 parent
9c84519
commit 2c337b5
Showing
13 changed files
with
118 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@shopware-pwa/composables-next": minor | ||
--- | ||
|
||
Changed `registration` method in the `useUser` composable. Because of changes in the double opt-in on registration flow in the Shopware backend we are adjusting this method on our side. In new approach we are checking `active` and `doubleOptInRegistration` properties that represents current status of the user. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"vue-demo-store": patch | ||
--- | ||
|
||
Fix registration form for the double opt in registration flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"vue-demo-store": minor | ||
--- | ||
|
||
Added a confirmation page after the double opt-in option. The confirmation link is included in the email after registration. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<script setup lang="ts"> | ||
import { ApiClientError } from "@shopware/api-client"; | ||
import type { ApiError } from "@shopware/api-client"; | ||
const { apiClient } = useShopwareContext(); | ||
const { refreshSessionContext } = useSessionContext(); | ||
const { pushSuccess, pushError } = useNotifications(); | ||
const { query } = useRoute(); | ||
const router = useRouter(); | ||
const { t } = useI18n(); | ||
const hash = query.hash; | ||
const em = query.em; | ||
const alreadyConfirmedError = ref(false); | ||
onMounted(async () => { | ||
try { | ||
await apiClient.invoke("registerConfirm post /account/register-confirm", { | ||
body: { | ||
hash: hash as string, | ||
em: em as string, | ||
}, | ||
}); | ||
await refreshSessionContext(); | ||
pushSuccess(t("account.messages.loggedInSuccess")); | ||
router.push({ path: "/" }); | ||
} catch (error) { | ||
if (error instanceof ApiClientError) { | ||
if ( | ||
error.details.errors[0].code === | ||
"CHECKOUT__CUSTOMER_IS_ALREADY_CONFIRMED" | ||
) { | ||
alreadyConfirmedError.value = true; | ||
} else { | ||
for (const singleError of error.details.errors) { | ||
if (singleError?.detail) { | ||
pushError(singleError.detail); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
</script> | ||
<template> | ||
<div class="flex justify-center items-center my-20"> | ||
<div v-if="!alreadyConfirmedError" class="flex flex-row items-center"> | ||
<p class="text-15">{{ $t("account.messages.verifying") }}</p> | ||
<div class="ml-10 size-15 i-carbon-circle-dash animate-spin animate-count-infinite animate-duration-2000" /> | ||
</div> | ||
<div v-else class="text-red flex items-center gap-5"> | ||
<div class="w-10 h-10 i-carbon-error" /> | ||
<p class="text-xl"> | ||
{{ $t("errors.CHECKOUT__CUSTOMER_IS_ALREADY_CONFIRMED") }} | ||
</p> | ||
</div> | ||
</div> | ||
</template> |