mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-06 05:40:02 -06:00
rename onboarding flag to fix onboarding not shown
This commit is contained in:
@@ -130,7 +130,7 @@ export const authOptions: NextAuthOptions = {
|
||||
select: {
|
||||
id: true,
|
||||
createdAt: true,
|
||||
onboardingDisplayed: true,
|
||||
onboardingCompleted: true,
|
||||
memberships: {
|
||||
select: {
|
||||
teamId: true,
|
||||
@@ -152,7 +152,7 @@ export const authOptions: NextAuthOptions = {
|
||||
const additionalAttributs = {
|
||||
id: existingUser.id,
|
||||
createdAt: existingUser.createdAt,
|
||||
onboardingDisplayed: existingUser.onboardingDisplayed,
|
||||
onboardingCompleted: existingUser.onboardingCompleted,
|
||||
teamId: existingUser.memberships.length > 0 ? existingUser.memberships[0].teamId : undefined,
|
||||
plan:
|
||||
existingUser.memberships.length > 0 && existingUser.memberships[0].team
|
||||
@@ -172,7 +172,7 @@ export const authOptions: NextAuthOptions = {
|
||||
// @ts-ignore
|
||||
session.user.createdAt = token?.createdAt ? new Date(token?.createdAt).toISOString() : undefined;
|
||||
// @ts-ignore
|
||||
session.user.onboardingDisplayed = token?.onboardingDisplayed;
|
||||
session.user.onboardingCompleted = token?.onboardingCompleted;
|
||||
// @ts-ignore
|
||||
session.user.teamId = token?.teamId;
|
||||
// @ts-ignore
|
||||
@@ -251,7 +251,7 @@ export const authOptions: NextAuthOptions = {
|
||||
name: user.name,
|
||||
email: user.email,
|
||||
emailVerified: new Date(Date.now()),
|
||||
onboardingDisplayed: false,
|
||||
onboardingCompleted: false,
|
||||
identityProvider: provider,
|
||||
identityProviderAccountId: user.id as string,
|
||||
accounts: {
|
||||
|
||||
@@ -60,7 +60,7 @@ export default function Onboarding({ session }: OnboardingProps) {
|
||||
const done = async () => {
|
||||
setIsLoading(true);
|
||||
try {
|
||||
const updatedProfile = { ...profile, onboardingDisplayed: true };
|
||||
const updatedProfile = { ...profile, onboardingCompleted: true };
|
||||
await triggerProfileMutate(updatedProfile);
|
||||
if (environment) {
|
||||
router.push(`/environments/${environment.id}/surveys`);
|
||||
|
||||
@@ -27,7 +27,7 @@ export default async function Home() {
|
||||
redirect("/auth/login");
|
||||
}
|
||||
|
||||
if (session?.user && !session?.user?.onboardingDisplayed) {
|
||||
if (session?.user && !session?.user?.onboardingCompleted) {
|
||||
return redirect(`/onboarding`);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ export const createUser = async (
|
||||
email,
|
||||
password: hashedPassword,
|
||||
inviteToken,
|
||||
onboardingDisplayed: false,
|
||||
onboardingCompleted: false,
|
||||
}),
|
||||
});
|
||||
if (res.status !== 200) {
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/*
|
||||
Warnings:
|
||||
|
||||
- You are about to drop the column `onboardingDisplayed` on the `User` table. All the data in the column will be lost.
|
||||
|
||||
*/
|
||||
-- AlterTable
|
||||
ALTER TABLE "User" DROP COLUMN "onboardingDisplayed",
|
||||
ADD COLUMN "onboardingCompleted" BOOLEAN NOT NULL DEFAULT false;
|
||||
@@ -334,7 +334,7 @@ model User {
|
||||
email String @unique
|
||||
emailVerified DateTime? @map(name: "email_verified")
|
||||
password String?
|
||||
onboardingDisplayed Boolean @default(false)
|
||||
onboardingCompleted Boolean @default(false)
|
||||
identityProvider IdentityProvider @default(email)
|
||||
identityProviderAccountId String?
|
||||
memberships Membership[]
|
||||
|
||||
2
packages/types/next-auth.d.ts
vendored
2
packages/types/next-auth.d.ts
vendored
@@ -12,7 +12,7 @@ declare module "next-auth" {
|
||||
plan?: string;
|
||||
email: string;
|
||||
name: string;
|
||||
onboardingDisplayed: boolean;
|
||||
onboardingCompleted: boolean;
|
||||
image?: StaticImageData;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user