mirror of
https://github.com/formbricks/formbricks.git
synced 2026-01-19 18:50:16 -06:00
fix: skip onboarding on invite and signup refactoring (#2507)
Co-authored-by: Johannes <72809645+jobenjada@users.noreply.github.com> Co-authored-by: Johannes <johannes@formbricks.com>
This commit is contained in:
@@ -20,17 +20,13 @@ export async function POST(request: Request) {
|
||||
if (!EMAIL_AUTH_ENABLED || inviteToken ? INVITE_DISABLED : !SIGNUP_ENABLED) {
|
||||
return Response.json({ error: "Signup disabled" }, { status: 403 });
|
||||
}
|
||||
user = { ...user, ...{ email: user.email.toLowerCase() } };
|
||||
|
||||
let inviteId;
|
||||
|
||||
try {
|
||||
let invite;
|
||||
let isInviteValid = false;
|
||||
|
||||
// create the user
|
||||
user = await createUser(user);
|
||||
|
||||
// User is invited to team
|
||||
if (inviteToken) {
|
||||
let inviteTokenData = await verifyInviteToken(inviteToken);
|
||||
inviteId = inviteTokenData?.inviteId;
|
||||
@@ -45,7 +41,20 @@ export async function POST(request: Request) {
|
||||
if (!invite) {
|
||||
return Response.json({ error: "Invalid invite ID" }, { status: 400 });
|
||||
}
|
||||
isInviteValid = true;
|
||||
}
|
||||
|
||||
user = {
|
||||
...user,
|
||||
...{ email: user.email.toLowerCase() },
|
||||
onboardingCompleted: isInviteValid,
|
||||
};
|
||||
|
||||
// create the user
|
||||
user = await createUser(user);
|
||||
|
||||
// User is invited to team
|
||||
if (isInviteValid) {
|
||||
// assign user to existing team
|
||||
await createMembership(invite.teamId, user.id, {
|
||||
accepted: true,
|
||||
|
||||
@@ -86,7 +86,7 @@ test.describe("Invite, accept and remove team member", async () => {
|
||||
await page.getByRole("link", { name: "Create account" }).click();
|
||||
|
||||
await signupUsingInviteToken(page, name, email, password);
|
||||
await finishOnboarding(page, false);
|
||||
await page.waitForURL(/\/environments\/[^/]+\/surveys/);
|
||||
});
|
||||
|
||||
test("Remove member", async ({ page }) => {
|
||||
|
||||
@@ -173,7 +173,7 @@ export const SurveysList = ({
|
||||
<div className="flex h-full flex-col items-center justify-center">
|
||||
<span className="mb-4 h-24 w-24 rounded-full bg-slate-100 p-6 text-5xl">🕵️</span>
|
||||
|
||||
<div className="text-slate-600">{isFetching ? "Fetching Surveys" : "No surveys found"}</div>
|
||||
<div className="text-slate-600">{isFetching ? "Fetching surveys..." : "No surveys found"}</div>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user