mirror of
https://github.com/supabase/supabase.git
synced 2026-10-13 21:29:08 +03:00
White list some non critical auth errors (#27049)
This commit is contained in:
1 parent
53bc34fa9e
commit
fcbf4f8f06
5 files changed
+29
-25
No files matched your search
@@ -6,6 +6,8 @@ import { auth } from 'lib/gotrue'
|
||||
import { passwordSchema } from 'lib/schemas'
|
||||
import { Button, Form, Input } from 'ui'
|
||||
|
||||
const WHITELIST_ERRORS = ['New password should be different from the old password']
|
||||
|
||||
const ResetPasswordForm = () => {
|
||||
const router = useRouter()
|
||||
|
||||
@@ -21,7 +23,9 @@ const ResetPasswordForm = () => {
|
||||
await router.push('/projects')
|
||||
} else {
|
||||
toast.error(`Failed to save password: ${error.message}`, { id: toastId })
|
||||
Sentry.captureMessage('[CRITICAL] Failed to reset password: ' + error.message)
|
||||
if (!WHITELIST_ERRORS.includes(error.message)) {
|
||||
Sentry.captureMessage('[CRITICAL] Failed to reset password: ' + error.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,8 @@ import { BASE_PATH } from 'lib/constants'
|
||||
import { auth, buildPathWithParams } from 'lib/gotrue'
|
||||
import { Button, Form, Input } from 'ui'
|
||||
|
||||
const WHITELIST_ERRORS = ['No SSO provider assigned for this domain']
|
||||
|
||||
const SignInSSOForm = () => {
|
||||
const queryClient = useQueryClient()
|
||||
const captchaRef = useRef<HCaptcha>(null)
|
||||
@@ -54,7 +56,10 @@ const SignInSSOForm = () => {
|
||||
setCaptchaToken(null)
|
||||
captchaRef.current?.resetCaptcha()
|
||||
toast.error(`Failed to sign in: ${error.message}`, { id: toastId })
|
||||
Sentry.captureMessage('[CRITICAL] Failed to sign in via SSO: ' + error.message)
|
||||
|
||||
if (!WHITELIST_ERRORS.includes(error.message)) {
|
||||
Sentry.captureMessage('[CRITICAL] Failed to sign in via SSO: ' + error.message)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
import { Lock } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import { Button } from 'ui'
|
||||
|
||||
const SignInWithSSO = ({ searchParams }: { searchParams?: string }) => {
|
||||
return (
|
||||
<Button asChild block size="large" type="outline" icon={<Lock width={18} height={18} />}>
|
||||
<Link
|
||||
href={{
|
||||
pathname: '/sign-in-sso',
|
||||
query: searchParams,
|
||||
}}
|
||||
>
|
||||
Continue with SSO
|
||||
</Link>
|
||||
</Button>
|
||||
)
|
||||
}
|
||||
|
||||
export default SignInWithSSO
|
||||
@@ -20,6 +20,8 @@ import {
|
||||
} from 'ui'
|
||||
import PasswordConditionsHelper from './PasswordConditionsHelper'
|
||||
|
||||
const WHITELIST_ERRORS = ['A user with this email already exists']
|
||||
|
||||
const signUpSchema = passwordSchema.shape({
|
||||
email: yup.string().email().required().label('Email'),
|
||||
})
|
||||
@@ -40,7 +42,10 @@ const SignUpForm = () => {
|
||||
setCaptchaToken(null)
|
||||
captchaRef.current?.resetCaptcha()
|
||||
toast.error(`Failed to sign up: ${error.message}`)
|
||||
Sentry.captureMessage('[CRITICAL] Failed to sign up: ' + error.message)
|
||||
|
||||
if (!WHITELIST_ERRORS.includes(error.message)) {
|
||||
Sentry.captureMessage('[CRITICAL] Failed to sign up: ' + error.message)
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { Lock } from 'lucide-react'
|
||||
import Link from 'next/link'
|
||||
import { useRouter } from 'next/router'
|
||||
import { useEffect } from 'react'
|
||||
|
||||
import SignInForm from 'components/interfaces/SignIn/SignInForm'
|
||||
import SignInWithGitHub from 'components/interfaces/SignIn/SignInWithGitHub'
|
||||
import SignInWithSSO from 'components/interfaces/SignIn/SignInWithSSO'
|
||||
import { SignInLayout } from 'components/layouts'
|
||||
import { IS_PLATFORM } from 'lib/constants'
|
||||
import type { NextPageWithLayout } from 'types'
|
||||
import { Button } from 'ui'
|
||||
|
||||
const SignInPage: NextPageWithLayout = () => {
|
||||
const router = useRouter()
|
||||
@@ -24,7 +25,16 @@ const SignInPage: NextPageWithLayout = () => {
|
||||
<>
|
||||
<div className="flex flex-col gap-5">
|
||||
<SignInWithGitHub />
|
||||
<SignInWithSSO searchParams={searchParams} />
|
||||
<Button asChild block size="large" type="outline" icon={<Lock width={18} height={18} />}>
|
||||
<Link
|
||||
href={{
|
||||
pathname: '/sign-in-sso',
|
||||
query: searchParams,
|
||||
}}
|
||||
>
|
||||
Continue with SSO
|
||||
</Link>
|
||||
</Button>
|
||||
|
||||
<div className="relative">
|
||||
<div className="absolute inset-0 flex items-center">
|
||||
|
||||
Reference in new issue
Block a user