Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

feat: remove sentry sign in events (#20084)

Stojan Dimitrovskiebb28813cad1
diff --git a/apps/studio/components/interfaces/SignIn/SignInForm.tsx b/apps/studio/components/interfaces/SignIn/SignInForm.tsx
index b91c9cc0937..84a88eb6568 100644
--- a/apps/studio/components/interfaces/SignIn/SignInForm.tsx
+++ b/apps/studio/components/interfaces/SignIn/SignInForm.tsx
@@ -10,7 +10,6 @@ import { object, string } from 'yup'
import { getMfaAuthenticatorAssuranceLevel } from 'data/profile/mfa-authenticator-assurance-level-query'
import { useStore } from 'hooks'
import { auth, buildPathWithParams, getReturnToPath } from 'lib/gotrue'
-import { incrementSignInClicks } from 'lib/local-storage'
import { Button, Form, Input } from 'ui'
const signInSchema = object({
@@ -45,11 +44,6 @@ const SignInForm = () => {
})
if (!error) {
- const signInClicks = incrementSignInClicks()
- if (signInClicks > 1) {
- Sentry.captureMessage('Sign in without previous sign out detected')
- }
-
try {
const data = await getMfaAuthenticatorAssuranceLevel()
if (data) {
diff --git a/apps/studio/components/interfaces/SignIn/SignInWithGitHub.tsx b/apps/studio/components/interfaces/SignIn/SignInWithGitHub.tsx
index 04199436011..d7338832004 100644
--- a/apps/studio/components/interfaces/SignIn/SignInWithGitHub.tsx
+++ b/apps/studio/components/interfaces/SignIn/SignInWithGitHub.tsx
@@ -1,7 +1,6 @@
import * as Sentry from '@sentry/nextjs'
import { BASE_PATH } from 'lib/constants'
import { auth, buildPathWithParams } from 'lib/gotrue'
-import { incrementSignInClicks } from 'lib/local-storage'
import { useState } from 'react'
import { Button, IconGitHub } from 'ui'
@@ -12,11 +11,6 @@ const SignInWithGitHub = () => {
setLoading(true)
try {
- const signInClicks = incrementSignInClicks()
- if (signInClicks > 1) {
- Sentry.captureMessage('Sign in without previous sign out detected')
- }
-
// redirects to /sign-in to check if the user has MFA setup (handled in SignInLayout.tsx)
const redirectTo = buildPathWithParams(
`${
diff --git a/apps/studio/components/interfaces/SignIn/SignUpForm.tsx b/apps/studio/components/interfaces/SignIn/SignUpForm.tsx
index d08a64ed988..4be3413cd80 100644
--- a/apps/studio/components/interfaces/SignIn/SignUpForm.tsx
+++ b/apps/studio/components/interfaces/SignIn/SignUpForm.tsx
@@ -6,7 +6,6 @@ import * as yup from 'yup'
import { useSignUpMutation } from 'data/misc/signup-mutation'
import { useStore } from 'hooks'
import { BASE_PATH } from 'lib/constants'
-import { resetSignInClicks } from 'lib/local-storage'
import { passwordSchema } from 'lib/schemas'
import PasswordConditionsHelper from './PasswordConditionsHelper'
@@ -47,7 +46,6 @@ const SignUpForm = () => {
token = captchaResponse?.response ?? null
}
- resetSignInClicks()
signup({
email,
password,
diff --git a/apps/studio/lib/auth.tsx b/apps/studio/lib/auth.tsx
index c2cee1c06ae..f7bb022779e 100644
--- a/apps/studio/lib/auth.tsx
+++ b/apps/studio/lib/auth.tsx
@@ -8,7 +8,7 @@ import {
} from 'common'
import { useStore } from 'hooks'
import { GOTRUE_ERRORS, IS_PLATFORM } from './constants'
-import { clearLocalStorage, resetSignInClicks } from './local-storage'
+import { clearLocalStorage } from './local-storage'
export const AuthContext = AuthContextInternal
@@ -41,8 +41,6 @@ export function useSignOut() {
const queryClient = useQueryClient()
return useCallback(async () => {
- resetSignInClicks()
-
const result = await gotrueClient.signOut()
clearLocalStorage()
await queryClient.clear()
diff --git a/apps/studio/lib/local-storage.ts b/apps/studio/lib/local-storage.ts
index 93ade1a3211..5acd14bbce8 100644
--- a/apps/studio/lib/local-storage.ts
+++ b/apps/studio/lib/local-storage.ts
@@ -5,7 +5,6 @@ export const LOCAL_STORAGE_KEYS_ALLOWLIST = [
'graphiql:theme',
'theme',
'supabaseDarkMode',
- 'supabase.dashboard.sign_in_clicks_v4',
'supabase.dashboard.auth.debug',
'supabase.dashboard.auth.navigatorLock.disabled',
LOCAL_STORAGE_KEYS.TELEMETRY_CONSENT,
@@ -18,52 +17,3 @@ export function clearLocalStorage() {
}
}
}
-
-function inferSignInClicks() {
- // remove old data from local storage
- ;['', '_v2', '_v3'].forEach((suffix) => {
- localStorage.removeItem(`supabase.dashboard.sign_in_clicks${suffix}`)
- })
-
- if (localStorage.getItem('supabase.dashboard.sign_in_clicks_v4')) {
- return
- }
-
- localStorage.setItem(
- 'supabase.dashboard.sign_in_clicks_v4',
- localStorage.getItem('supabase.dashboard.auth.token') ? '1' : '0'
- )
-}
-
-export function getSignInClicks(): number {
- let count: number | null = null
-
- try {
- count = JSON.parse(localStorage.getItem('supabase.dashboard.sign_in_clicks_v4') || '0')
- } catch (e: any) {
- // do nothing
- }
-
- return count || 0
-}
-
-export function incrementSignInClicks(): number {
- const clicks = getSignInClicks()
-
- localStorage.setItem('supabase.dashboard.sign_in_clicks_v4', JSON.stringify(clicks + 1))
-
- return clicks + 1
-}
-
-export function resetSignInClicks(): number {
- const clicks = getSignInClicks()
-
- localStorage.setItem('supabase.dashboard.sign_in_clicks_v4', '0')
-
- return clicks
-}
-
-if (globalThis && globalThis.localStorage && IS_PLATFORM) {
- // populate the value based on the current local storage state
- inferSignInClicks()
-}