Skip to content

πŸ“ˆ Open source, privacy-first web analytics β€” a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

Get rid of email verification step

Blue Mouse1aa8e4d0e898
diff --git a/backend/apps/cloud/src/auth/auth.service.ts b/backend/apps/cloud/src/auth/auth.service.ts
index 8f5b93ee6..c3c39d464 100644
--- a/backend/apps/cloud/src/auth/auth.service.ts
+++ b/backend/apps/cloud/src/auth/auth.service.ts
@@ -179,11 +179,9 @@ export class AuthService {
const user = await this.userService.createUser({
email,
- password: hashedPassword, // Using the password field is incorrect.
+ password: hashedPassword,
})
- await this.sendVerificationEmail(user.id, user.email)
-
return user
}
diff --git a/backend/apps/cloud/src/common/templates/en/customer_sign-up.html b/backend/apps/cloud/src/common/templates/en/customer_sign-up.html
index 88e2ea45a..7e5ba7efb 100644
--- a/backend/apps/cloud/src/common/templates/en/customer_sign-up.html
+++ b/backend/apps/cloud/src/common/templates/en/customer_sign-up.html
@@ -15,7 +15,8 @@ during your trial. Here's what happens next:<br />
</ul>
You can manage your subscription or cancel anytime from your
-<a href="https://swetrix.com/billing" target="_blank">Billing page</a
+<a href="https://swetrix.com/user-settings?tab=billing" target="_blank"
+ >Billing page</a
>.<br /><br />
<b>Get started:</b><br />
@@ -35,13 +36,6 @@ You can manage your subscription or cancel anytime from your
</li>
</ul>
-To verify your email address, please
-<a href="{{url}}">click here</a>.<br /><br />
+Questions? Just reply to this email - we're happy to help!<br /><br />
-If you're having trouble with the link above, copy and paste this URL into your
-browser:<br />
-{{url}}<br /><br />
-
-Questions? Just reply to this email - we're happy to help.<br /><br />
-
-Andrii Romasiun, Swetrix
+Andrii Romasiun Founder, Swetrix
diff --git a/backend/apps/cloud/src/common/templates/en/trial-ends-tomorrow.html b/backend/apps/cloud/src/common/templates/en/trial-ends-tomorrow.html
index f99ba1c2e..14f22010e 100644
--- a/backend/apps/cloud/src/common/templates/en/trial-ends-tomorrow.html
+++ b/backend/apps/cloud/src/common/templates/en/trial-ends-tomorrow.html
@@ -2,12 +2,12 @@ Hey there,<br /><br />
Just a heads up - your free Swetrix trial ends in about 48 hours.<br /><br />
-Most companies don't email you before your trial expires because they hope
-you'll forget and get charged anyway. We're doing the opposite β€” we don't want
-your money if you don't want to give it to us.<br /><br />
+Most companies don't email you before your trial expires hoping for an easy cash
+grab. We're doing the opposite β€” we don't want your money if you don't want to
+give it to us.<br /><br />
If you're loving Swetrix, you don't need to do anything. Your subscription will
-begin automatically and you'll keep getting privacy-first analytics without
+activate automatically and you'll keep getting privacy-first analytics without
interruption.<br /><br />
If it's not the right fit, no hard feelings. You can
@@ -17,4 +17,4 @@ trial ends and you won't be charged.<br /><br />
Got questions about your plan, features, or anything else? Just reply to this
email β€” we're here to help.<br /><br />
-Andrii Romasiun, Swetrix
+Andrii Romasiun Founder, Swetrix
diff --git a/backend/apps/cloud/src/task-manager/task-manager.service.ts b/backend/apps/cloud/src/task-manager/task-manager.service.ts
index 728edd246..91a6b18d2 100644
--- a/backend/apps/cloud/src/task-manager/task-manager.service.ts
+++ b/backend/apps/cloud/src/task-manager/task-manager.service.ts
@@ -893,7 +893,7 @@ export class TaskManagerService {
user,
hitPercentageLimit: _includes(exceedingUserIds, user.id),
percentageLimit: TRAFFIC_SPIKE_ALLOWED_PERCENTAGE * 100,
- billingUrl: 'https://swetrix.com/billing',
+ billingUrl: 'https://swetrix.com/user-settings?tab=billing',
suggestedPlanLimit: suggestedPlanLimit?.monthlyUsageLimit,
}
@@ -950,7 +950,7 @@ export class TaskManagerService {
upgradePeriodDays: 7,
thisMonthUsage: usage,
percentageLimit: TRAFFIC_SPIKE_ALLOWED_PERCENTAGE * 100,
- billingUrl: 'https://swetrix.com/billing',
+ billingUrl: 'https://swetrix.com/user-settings?tab=billing',
suggestedPlanLimit: suggestedPlanLimit?.monthlyUsageLimit,
}
@@ -1021,7 +1021,7 @@ export class TaskManagerService {
thisMonthUsage: userThisMonthUsage,
lastMonthUsage: userLastMonthUsage,
percentageLimit: TRAFFIC_SPIKE_ALLOWED_PERCENTAGE * 100,
- billingUrl: 'https://swetrix.com/billing',
+ billingUrl: 'https://swetrix.com/user-settings?tab=billing',
suggestedPlanLimit: suggestedPlanLimit?.monthlyUsageLimit,
}
@@ -1068,7 +1068,7 @@ export class TaskManagerService {
})
const emailParams = {
amount: SEND_WARNING_AT_PERC,
- url: 'https://swetrix.com/billing',
+ url: 'https://swetrix.com/user-settings?tab=billing',
}
const promises = _map(users, async (user) => {
@@ -1384,7 +1384,7 @@ export class TaskManagerService {
email,
LetterTemplate.TrialEndsTomorrow,
{
- url: 'https://swetrix.com/billing',
+ url: 'https://swetrix.com/user-settings?tab=billing',
},
)
})
@@ -1447,7 +1447,7 @@ export class TaskManagerService {
// trialEndDate: null,
})
await this.mailerService.sendEmail(email, LetterTemplate.TrialExpired, {
- url: 'https://swetrix.com/billing',
+ url: 'https://swetrix.com/user-settings?tab=billing',
})
await this.projectService.clearProjectsRedisCache(id)
})
diff --git a/backend/apps/cloud/src/user/user.controller.ts b/backend/apps/cloud/src/user/user.controller.ts
index a2b1e87e1..f5230861d 100644
--- a/backend/apps/cloud/src/user/user.controller.ts
+++ b/backend/apps/cloud/src/user/user.controller.ts
@@ -835,12 +835,6 @@ export class UserController {
async completeOnboarding(@CurrentUserId() userId: string): Promise<void> {
this.logger.log({ userId }, 'POST /user/onboarding/complete')
- const user = await this.userService.findOne({ where: { id: userId } })
-
- if (!user?.isActive) {
- throw new ForbiddenException('Please, verify your email address first')
- }
-
await this.userService.update(userId, {
onboardingStep: OnboardingStep.COMPLETED,
hasCompletedOnboarding: true,
diff --git a/backend/apps/cloud/src/user/user.service.ts b/backend/apps/cloud/src/user/user.service.ts
index 729f5c7e6..707d63011 100644
--- a/backend/apps/cloud/src/user/user.service.ts
+++ b/backend/apps/cloud/src/user/user.service.ts
@@ -222,6 +222,7 @@ export class UserService {
public async createUser(user: Pick<User, 'email' | 'password'>) {
return this.usersRepository.save({
...user,
+ isActive: true,
trialEndDate: dayjs
.utc()
.add(TRIAL_DURATION, 'day')
diff --git a/backend/apps/cloud/src/webhook/webhook.controller.ts b/backend/apps/cloud/src/webhook/webhook.controller.ts
index 7ef5f1f27..aec883260 100644
--- a/backend/apps/cloud/src/webhook/webhook.controller.ts
+++ b/backend/apps/cloud/src/webhook/webhook.controller.ts
@@ -180,12 +180,19 @@ export class WebhookController {
await this.userService.update(currentUser.id, updateParams)
await this.projectService.clearProjectsRedisCache(currentUser.id)
+ if (body.alert_name === 'subscription_created' && isTrialing) {
+ await this.mailerService.sendEmail(
+ currentUser.email,
+ LetterTemplate.SignUp,
+ )
+ }
+
if (status === 'paused') {
await this.mailerService.sendEmail(
currentUser.email,
LetterTemplate.DashboardLockedPaymentFailure,
{
- billingUrl: 'https://swetrix.com/billing',
+ billingUrl: 'https://swetrix.com/user-settings?tab=billing',
},
)
}
diff --git a/docs/content/docs/accountsettings/delete-account.mdx b/docs/content/docs/accountsettings/delete-account.mdx
index e0b710380..ceeee0711 100644
--- a/docs/content/docs/accountsettings/delete-account.mdx
+++ b/docs/content/docs/accountsettings/delete-account.mdx
@@ -5,7 +5,7 @@ slug: /settings/delete-account
To delete your Swetrix account, you need to log in to your account and go to the [account settings page](https://swetrix.com/user-settings).
-Make sure you unsubscribed from the paid subscription if you have one. You can do this on the [billing page](https://swetrix.com/billing).
+Make sure you unsubscribed from the paid subscription if you have one. You can do this on the [billing page](https://swetrix.com/user-settings?tab=billing).
Click on the "Account" tab and then down to the end of the page. There you will see the "Delete account" button that will allow you to delete your account.
diff --git a/docs/content/docs/api/events.mdx b/docs/content/docs/api/events.mdx
index 7e6452093..6554514c2 100644
--- a/docs/content/docs/api/events.mdx
+++ b/docs/content/docs/api/events.mdx
@@ -223,7 +223,7 @@ This error is usually returned when the request body is malformed (for example,
### 402 Payment Required
-This error is usually returned when the project is not active (i.e. the subscription has expired or the quota has been exceeded). Please go to the [Billing](https://swetrix.com/billing) page to check the current status and usage of your subscription.
+This error is usually returned when the project is not active (i.e. the subscription has expired or the quota has been exceeded). Please go to the [Billing](https://swetrix.com/user-settings?tab=billing) page to check the current status and usage of your subscription.
### 403 Forbidden
diff --git a/docs/content/docs/billing/cancel-subscription.mdx b/docs/content/docs/billing/cancel-subscription.mdx
index 2d5deea5f..bcba7246e 100644
--- a/docs/content/docs/billing/cancel-subscription.mdx
+++ b/docs/content/docs/billing/cancel-subscription.mdx
@@ -3,6 +3,6 @@ title: How to cancel your subscription
slug: /cancel-your-subscription
---
-To cancel your subscription plan, log into your account and go to the [Billing](https://swetrix.com/billing) page. To cancel your subscription, click on the "Cancel subscription" button located next to the tier selector.
+To cancel your subscription plan, log into your account and go to the [Billing](https://swetrix.com/user-settings?tab=billing) page. To cancel your subscription, click on the "Cancel subscription" button located next to the tier selector.
After cancelling, you will still have access to your dashboard and statistics will continue to be collected until the end of your current subscription cycle.
diff --git a/docs/content/docs/billing/faq.mdx b/docs/content/docs/billing/faq.mdx
index ae5df5ed5..22bd96a14 100644
--- a/docs/content/docs/billing/faq.mdx
+++ b/docs/content/docs/billing/faq.mdx
@@ -58,4 +58,4 @@ If you are still having this issue, please [contact us](https://swetrix.com/cont
## How can I update my payment information?
-To update your billing information, log in to your account and go to the [Billing](https://swetrix.com/billing) page.There you will find an "Update payment details" button which will take you to the Paddle subscription management page where you can edit your payment details.
+To update your billing information, log in to your account and go to the [Billing](https://swetrix.com/user-settings?tab=billing) page.There you will find an "Update payment details" button which will take you to the Paddle subscription management page where you can edit your payment details.
diff --git a/docs/content/docs/billing/update-subscription.mdx b/docs/content/docs/billing/update-subscription.mdx
index 9f68336eb..a21a5c40b 100644
--- a/docs/content/docs/billing/update-subscription.mdx
+++ b/docs/content/docs/billing/update-subscription.mdx
@@ -3,7 +3,7 @@ title: How to update your subscription plan
slug: /update-your-subscription
---
-To change your subscription plan, log into your account and go to the [Billing](https://swetrix.com/billing) page. There you will find a subscription selector that allows you to choose a plan based on how much traffic your site has.
+To change your subscription plan, log into your account and go to the [Billing](https://swetrix.com/user-settings?tab=billing) page. There you will find a subscription selector that allows you to choose a plan based on how much traffic your site has.
Once you have selected the plan that best suits your usage, press "Upgrade". This will bring up a modal that will tell you how much you need to pay now and in the next billing cycle.
diff --git a/docs/content/docs/billing/upgrade-from-trial.mdx b/docs/content/docs/billing/upgrade-from-trial.mdx
index 3ad390644..5de4f712c 100644
--- a/docs/content/docs/billing/upgrade-from-trial.mdx
+++ b/docs/content/docs/billing/upgrade-from-trial.mdx
@@ -16,7 +16,7 @@ At any time during your trial, or once it's over, you can upgrade to a paid subs
<Step>
### Choose a plan
-Log in to your account and go to the [billing page](https://swetrix.com/billing).
+Log in to your account and go to the [billing page](https://swetrix.com/user-settings?tab=billing).
You will see the Plan usage section with an indicator of how many events you used during the current calendar month. You can hover over this chart and see what kind of events you used during that period.
diff --git a/web/app/pages/Onboarding/Onboarding.tsx b/web/app/pages/Onboarding/Onboarding.tsx
index e424cc47a..b2ff2b690 100644
--- a/web/app/pages/Onboarding/Onboarding.tsx
+++ b/web/app/pages/Onboarding/Onboarding.tsx
@@ -18,7 +18,6 @@ import { toast } from 'sonner'
import { useAuthProxy } from '~/hooks/useAuthProxy'
import {
BROWSER_LOGO_MAP,
- CONFIRMATION_TIMEOUT,
DOCS_URL,
INTEGRATIONS_URL,
isSelfhosted,
@@ -28,7 +27,6 @@ import {
OS_LOGO_MAP,
OS_LOGO_MAP_DARK,
} from '~/lib/constants'
-import { getCookie, setCookie } from '~/utils/cookie'
import { changeLanguage } from '~/i18n'
import { getSnippet } from '~/modals/TrackingSnippet'
import { useAuth } from '~/providers/AuthProvider'
@@ -68,25 +66,16 @@ type OnboardingStep =
| 'feature_sessions'
| 'create_project'
| 'setup_tracking'
- | 'verify_email'
-
-const getSteps = (): OnboardingStep[] => {
- const baseSteps: OnboardingStep[] = [
- 'language',
- 'welcome',
- 'feature_traffic',
- 'feature_errors',
- 'feature_sessions',
- 'create_project',
- 'setup_tracking',
- ]
-
- if (!isSelfhosted) {
- baseSteps.push('verify_email')
- }
- return baseSteps
-}
+const getSteps = (): OnboardingStep[] => [
+ 'language',
+ 'welcome',
+ 'feature_traffic',
+ 'feature_errors',
+ 'feature_sessions',
+ 'create_project',
+ 'setup_tracking',
+]
const STEPS = getSteps()
@@ -442,10 +431,6 @@ const Onboarding = () => {
const [newProjectErrors, setNewProjectErrors] = useState<{
name?: string
}>({})
- const [isCheckingVerification, setIsCheckingVerification] = useState(false)
- const [hasResentEmail, setHasResentEmail] = useState(
- () => !!getCookie(CONFIRMATION_TIMEOUT),
- )
const currentStep = STEPS[currentStepIndex]
const isLoading =
@@ -472,10 +457,6 @@ const Onboarding = () => {
} else if (intent === 'complete-onboarding') {
loadUser()
navigate(isSelfhosted ? routes.dashboard : routes.checkout)
- } else if (intent === 'confirm-email') {
- setCookie(CONFIRMATION_TIMEOUT, true, 600)
- setHasResentEmail(true)
- toast.success(t('profileSettings.confSent'))
}
} else if (fetcher.data?.error) {
toast.error(fetcher.data.error)
@@ -613,25 +594,6 @@ const Onboarding = () => {
fetcher.submit(formData, { method: 'post' })
}
- const handleDeleteAccount = () => {
- if (fetcher.state !== 'idle') return
-
- const formData = new FormData()
- formData.set('intent', 'delete-account')
- fetcher.submit(formData, { method: 'post' })
- }
-
- const handleResendEmail = () => {
- if (getCookie(CONFIRMATION_TIMEOUT)) {
- toast.error(t('profileSettings.confTimeout'))
- return
- }
-
- const formData = new FormData()
- formData.set('intent', 'confirm-email')
- fetcher.submit(formData, { method: 'post' })
- }
-
if (!user) {
return (
<div className='flex min-h-screen items-center justify-center bg-gray-50 dark:bg-slate-950'>
@@ -1027,93 +989,6 @@ const Onboarding = () => {
)}
</div>
)}
-
- {currentStep === 'verify_email' && (
- <div>
- <Text
- as='h1'
- size='3xl'
- weight='bold'
- tracking='tight'
- className='mb-2'
- >
- {t('onboarding.confirm.title')}
- </Text>
-
- {user?.isActive ? (
- <Alert variant='success' className='mt-8'>
- {t('onboarding.confirm.emailVerified')}
- </Alert>
- ) : (
- <>
- <Text
- as='h2'
- size='lg'
- weight='semibold'
- className='mt-8 mb-4'
- >
- {t('onboarding.confirm.emailVerification')}
- </Text>
-
- <Alert
- variant='info'
- title={t('onboarding.confirm.verifyTitle')}
- >
- <Trans
- t={t}
- i18nKey='onboarding.confirm.linkSent'
- values={{ email: user?.email }}
- components={{
- email: <span className='font-semibold' />,
- }}
- />
- </Alert>
-
- <div className='mt-6'>
- <Text
- as='p'
- size='sm'
- colour='secondary'
- className='mb-2'
- >
- {t('onboarding.confirm.didNotReceive')}
- </Text>
- <Button
- onClick={handleResendEmail}
- disabled={hasResentEmail}
- secondary
- small
- >
- {hasResentEmail && (
- <CheckCircleIcon className='mr-2 size-4' />
- )}
- {hasResentEmail
- ? t('onboarding.confirm.emailResent')
- : t('onboarding.confirm.resend')}
- </Button>
- </div>
-
- <div className='mt-6'>
- <Text
- as='p'
- size='sm'
- colour='secondary'
- className='mb-2'
- >
- {t('onboarding.confirm.troubleOrChange')}
- </Text>
- <Button
- onClick={handleDeleteAccount}
- secondary
- small
- >
- {t('onboarding.confirm.logoutAndRegister')}
- </Button>
- </div>
- </>
- )}
- </div>
- )}
</motion.div>
</AnimatePresence>
</div>
@@ -1154,11 +1029,7 @@ const Onboarding = () => {
<Button
onClick={() => {
setIsWaitingForEvents(true)
- if (isSelfhosted) {
- handleCompleteOnboarding(false)
- } else {
- goNext()
- }
+ handleCompleteOnboarding(false)
}}
primary
large
@@ -1166,30 +1037,6 @@ const Onboarding = () => {
{t('common.continue')}
</Button>
)}
- {currentStep === 'verify_email' && (
- <Button
- onClick={async () => {
- setIsCheckingVerification(true)
- try {
- const loadedUser = await loadUser()
- if (!loadedUser?.isActive) {
- toast.error(
- 'Please, verify your email address first',
- )
- return
- }
- handleCompleteOnboarding(false)
- } finally {
- setIsCheckingVerification(false)
- }
- }}
- loading={isCheckingVerification}
- primary
- large
- >
- {t('onboarding.confirm.letsGo')}
- </Button>
- )}
</div>
</div>
</div>
diff --git a/web/app/routes/onboarding.tsx b/web/app/routes/onboarding.tsx
index 33dbc6caf..4ccd66956 100644
--- a/web/app/routes/onboarding.tsx
+++ b/web/app/routes/onboarding.tsx
@@ -95,14 +95,17 @@ export async function loader({ request }: LoaderFunctionArgs) {
}
const rawOnboardingStep = user?.user?.onboardingStep as string | undefined
- // Migrate users who were on the removed select_plan step
+ // Migrate users who were on removed steps
const onboardingStep =
- rawOnboardingStep === 'select_plan' ? 'create_project' : rawOnboardingStep
+ rawOnboardingStep === 'select_plan'
+ ? 'create_project'
+ : rawOnboardingStep === 'verify_email'
+ ? 'setup_tracking'
+ : rawOnboardingStep
if (
onboardingStep === 'setup_tracking' ||
- onboardingStep === 'waiting_for_events' ||
- onboardingStep === 'verify_email'
+ onboardingStep === 'waiting_for_events'
) {
const projectsResult = await serverFetch<{
results: Project[]
@@ -249,39 +252,6 @@ export async function action({ request }: ActionFunctionArgs) {
)
}
- case 'delete-account': {
- const result = await serverFetch(request, 'user', {
- method: 'DELETE',
- })
-
- if (result.error) {
- return data<OnboardingActionData>(
- { intent, error: result.error as string },
- { status: 400 },
- )
- }
-
- return redirect('/logout')
- }
-
- case 'confirm-email': {
- const result = await serverFetch(request, 'user/confirm_email', {
- method: 'POST',
- })
-
- if (result.error) {
- return data<OnboardingActionData>(
- { intent, error: result.error as string },
- { status: 400 },
- )
- }
-
- return data<OnboardingActionData>(
- { intent, success: true },
- { headers: createHeadersWithCookies(result.cookies) },
- )
- }
-
default:
return data<OnboardingActionData>(
{ error: 'Unknown action' },
diff --git a/web/public/locales/en.json b/web/public/locales/en.json
index 9239d3a8c..22938df76 100644
--- a/web/public/locales/en.json
+++ b/web/public/locales/en.json
@@ -2186,24 +2186,6 @@
"chargeDesc": "Your subscription begins unless you cancel beforehand"
}
},
- "confirm": {
- "navTitle": "Confirm your email",
- "navDesc": "Check your inbox and click the confirmation link.",
- "title": "One step left and you're ready to go! πŸš€",
- "emailVerification": "Email Verification",
- "verifyTitle": "Please verify your email address",
- "linkSent": "We sent an email to <email>{{email}}</email>. Please confirm your email address to continue.",
- "didNotReceive": "Did not receive an email?",
- "resend": "Resend",
- "emailResent": "Requested",
- "troubleOrChange": "Do you have trouble or want to change your email address?",
- "logoutAndRegister": "Logout and register again",
- "letsGo": "Let's go!",
- "emailVerified": "Your email is verified",
- "spam": "Can't see the email? Please check your spam folder.",
- "wrongEmail": "Wrong email? <url>Create a new account.</url>",
- "checkVerification": "I've verified my email"
- },
"createProject": {
"navTitle": "Create a project",
"navDesc": "Add a website to start tracking analytics.",