Skip to content

Commit

Permalink
feat(sign in): when license in query log out before logging in
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroAkbal committed Jul 21, 2024
1 parent fb72232 commit a8644b6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions middleware/auth-redirect-if-logged-in.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
export default defineNuxtRouteMiddleware((to, from) => {
const { $pocketBase } = useNuxtApp()

// Skip if license query is set
if (to.query.license) {
return
}

if ($pocketBase.authStore.isValid) {
return navigateTo('/premium/dashboard')
}
Expand Down
4 changes: 4 additions & 0 deletions pages/premium/sign-in.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
}
if (license) {
if ($pocketBase.authStore.isValid) {
$pocketBase.authStore.clear()
}
formData.value.password = license
onSubmit()
Expand Down

0 comments on commit a8644b6

Please sign in to comment.