Files
SuhailandGitHub c5d1ead858 refactor: Revamped signup flow (#2372)
* refactor: revamped signup flow

* fix: redirect user to relevant route on login

* refactor: better sidebar hiding logic

* fix: redundant site names for normal sites

* refactor: use product request's plan value instead of passing it

* fix: pre select site if there's only one

* fix: remove unused page

* fix: add skip to dashboard button

* refactor: use list view for sites

- show site label while signing up
- other minor changes

* fix: navigate user to dashboard or start center as required

* fix: show start center for users with <5 sites

* fix: set site label with first name only

* fix: complete setup wizard for pooled sites

* fix: add better empty state message in start center

* refactor: Let user input the site label

* feat: Webhook to sync user on creation on sites

* fix: Track if user is a product trial user in team

* fix: Hide notifications for product trial user

* fix: Inverted condition for groups, servers and devbox

* fix: hide login warning and sidebar in signup screens

* refactor: Show different site list for product trial user

* refactor: add app name in product site's subdomain

* feat: Site login page

a page for users to immediately login to their site via OTP flow

* fix: only let user to login if they have verified their otp

* fix: route for product login

* fix: Consistent usage of verification code instead of otp

* fix: Add 2 webhook record for update and create of user

* refactor: Use site login page instead of start center

- user can login to their site irrespective of if they have account in press, since we will store the user site map for every site
- use session log dt for otp stuff
- use cookies to keep session for 5 days

* refactor: Use correct variable name

* chore: remove start center file

* fix: uncomment rate limit

* chore: remove comments

* chore: remove test code

* fix: button label case

* fix: Better subtitle in site login

* refactor: Better app selector design following login card

* fix: `site_session_id` -> `site_user_sid`

* fix: Better title

* refactor: Use max age instead of expires

* fix: Add webhook for user deletion

* fix: Track if otp is verified

* fix: Create new session when older one is expired

* fix: Don't route user to login from signup if they exist

* fix: Remove cookie methods

* refactor: Use LoginBox in signup flow

* refactor: move site user under press module

* fix: mark team as product user on signup

* fix: Update route to dashboard for in desk login

* fix: don't set user to admin on creating site

* fix: Create a webhook on site created

* fix: otp cheat code

* feat: fallback to sync site user map

* fix: Expire OTP after 5 minutes

* fix: Allow unique site labels only

* refactor: Use LoginBox in site login page

* fix: Remove extra brace

* fix: Bigger space between checkbox and inputs

* chore: remove dead code

* fix: Welcome flow for users who dropped in between signup flow

- also reuse is_saas_user field instead of a new one

* fix: Update app trial page url

* fix: Make site label team wise unique

* fix: show site label and site name

* fix: typo

* fix: Allow resending otp after 30 seconds

* fix: add loading state before loading app data

* fix: Don't allow users to resend otp before 30s pass

* refactor: improved payment flow

- handhold user to add payment mode and take them back to site's page
- fix an issue where duplicate account requests are created

* fix: muted powered by fc text

* refactor: remove weird condition for subtitle

* fix: remove print statements

* refactor: `site_label` -> `label`

* fix: render subtitle

* refactor: better var name

* refactor: better dev setup check

* fix: use explicit field to track otp generated time

* revert: unneeded change

* fix: remove show normal site list view for all users

since we have /site-login page for site login

* fix: remove commented out routes
2025-02-04 10:20:14 +05:30

99 lines
2.7 KiB
Vue

<template>
<div class="relative flex h-full flex-col">
<div class="h-full flex-1">
<div class="flex h-full">
<div
v-if="!isSignupFlow && !$isMobile && !isHideSidebar"
class="relative block min-h-0 flex-shrink-0 overflow-hidden hover:overflow-auto"
>
<AppSidebar v-if="$session.user" />
</div>
<div class="w-full overflow-auto" id="scrollContainer">
<MobileNav
v-if="!isSignupFlow && $isMobile && !isHideSidebar && $session.user"
/>
<div
v-if="
!isSignupFlow &&
!isSiteLogin &&
!$session.user &&
!$route.meta.isLoginPage
"
class="border bg-red-200 px-5 py-3 text-base text-red-900"
>
You are not logged in.
<router-link to="/login" class="underline">Login</router-link> to
access dashboard.
</div>
<router-view />
</div>
</div>
</div>
<Toaster position="top-right" />
<component v-for="dialog in dialogs" :is="dialog" :key="dialog.id" />
</div>
</template>
<script setup>
import { defineAsyncComponent, computed, watch, ref, provide } from 'vue';
import { Toaster } from 'vue-sonner';
import { dialogs } from './utils/components';
import { useRoute } from 'vue-router';
import { getTeam } from './data/team';
import { session } from './data/session.js';
const AppSidebar = defineAsyncComponent(
() => import('./components/AppSidebar.vue'),
);
const MobileNav = defineAsyncComponent(
() => import('./components/MobileNav.vue'),
);
const route = useRoute();
const team = getTeam();
const isHideSidebar = computed(() => {
const alwaysHideSidebarRoutes = [
'Site Login',
'SignupLoginToSite',
'SignupSetup',
];
const alwaysHideSidebarPaths = ['/dashboard/site-login'];
if (!session.user) return false;
if (
alwaysHideSidebarRoutes.includes(route.name) ||
alwaysHideSidebarPaths.includes(window.location.pathname)
)
return true;
return (
route.meta.hideSidebar && session.user && team?.doc?.hide_sidebar === true
);
});
const isSignupFlow = ref(
window.location.pathname.startsWith('/dashboard/create-site') ||
window.location.pathname.startsWith('/dashboard/setup-account') ||
window.location.pathname.startsWith('/dashboard/site-login') ||
window.location.pathname.startsWith('/dashboard/signup'),
);
const isSiteLogin = ref(window.location.pathname.endsWith('/site-login'));
watch(
() => route.name,
() => {
isSignupFlow.value =
window.location.pathname.startsWith('/dashboard/create-site') ||
window.location.pathname.startsWith('/dashboard/setup-account') ||
window.location.pathname.startsWith('/dashboard/site-login') ||
window.location.pathname.startsWith('/dashboard/signup');
},
);
provide('team', team);
provide('session', session);
</script>
<style src="../src/assets/style.css"></style>