Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: ✨ add support for email verification on sign up #29

Open
wants to merge 8 commits into
base: staging
Choose a base branch
from
22 changes: 22 additions & 0 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import type { GlobalThemeOverrides } from "naive-ui";
import { materialTheme, Notifications, Notivue } from "notivue";

import router from "@/router";
import { useAuthStore } from "@/stores/auth";
import { theme } from "@/stores/settings";

const themeOverrides: GlobalThemeOverrides = {
Expand All @@ -17,6 +19,26 @@ const themeOverrides: GlobalThemeOverrides = {
labelFontWeight: "600",
},
};

router.beforeResolve(async (to) => {
const authStore = useAuthStore();
if (authStore.user.email_verified) {
return true;
}
if (
to.name == "auth:signup" ||
to.name == "auth:logout" ||
to.name == "auth:login" ||
to.name == "auth:confirm-email" ||
to.name == "auth:verify-email"
) {
return true;
}
router.push({
name: "auth:confirm-email",
query: { email: authStore.user.email_address },
});
});
</script>

<template>
Expand Down
Loading
Loading