Skip to content

Commit

Permalink
Fix confrimation aborting, when no code or from path mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
erunks committed Nov 23, 2023
1 parent b99f833 commit 5fe11d3
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions middleware/confirm-account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { useModalAlert } from 'composables/useModalAlert'

export default defineNuxtRouteMiddleware((_to, from) => {
const route = useRoute()
const confirmationCode = route.query.code as string
const confirmationCode = route.query?.code as string
const modalAlertState = useModalAlert().value

if (from !== `/confirm-account?code=${confirmationCode}`) {
navigateTo('/', { replace: true })
if (
!confirmationCode ||
from?.fullPath !== `/confirm-account?code=${confirmationCode}`
) {
return navigateTo('/', { replace: true })
}

useConfirmAccount(confirmationCode, {
Expand Down

0 comments on commit 5fe11d3

Please sign in to comment.