The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
must be logged in to reset password
Alaister Young8f376a6d8202
diff --git a/package-lock.json b/package-lock.jsonindex 2dbf19aca1b..8fd5506887c 100644--- a/package-lock.json+++ b/package-lock.json@@ -61273,7 +61273,7 @@"uniforms-bridge-json-schema": "^3.6.2","uuid": "^8.3.2","yup": "^0.32.11",- "yup-password": "*",+ "yup-password": "^0.2.2","zxcvbn": "^4.4.2"},"dependencies": {diff --git a/studio/components/interfaces/SignIn/ResetPasswordForm.tsx b/studio/components/interfaces/SignIn/ResetPasswordForm.tsxindex f952f926cd4..82a50d7b071 100644--- a/studio/components/interfaces/SignIn/ResetPasswordForm.tsx+++ b/studio/components/interfaces/SignIn/ResetPasswordForm.tsx@@ -2,12 +2,14 @@ import { useStore } from 'hooks'import { auth } from 'lib/gotrue'import { useRouter } from 'next/router'import { Button, Form, Input } from 'ui'-import { object, string } from 'yup'+import * as yup from 'yup'+import YupPassword from 'yup-password'-const resetPasswordSchema = object({- password: string()- .required('Password is required')- .min(8, 'Password must be at least 8 characters long'),+// extend yup with password validation+YupPassword(yup)++const resetPasswordSchema = yup.object({+ password: yup.string().password().required().label('Password'),})const ResetPasswordForm = () => {diff --git a/studio/hooks/misc/withAuth.tsx b/studio/hooks/misc/withAuth.tsxindex c0f33c58669..ca8f3f25a91 100644--- a/studio/hooks/misc/withAuth.tsx+++ b/studio/hooks/misc/withAuth.tsx@@ -6,17 +6,18 @@ import { STORAGE_KEY } from 'lib/gotrue'import { IS_PLATFORM } from 'lib/constants'import { useProfile, useStore, usePermissions } from 'hooks'import Error500 from '../../pages/500'+import { NextPageWithLayout } from 'types'const PLATFORM_ONLY_PAGES = ['storage', 'reports', 'settings']export function withAuth<T>(- WrappedComponent: ComponentType<T>,+ WrappedComponent: ComponentType<T> | NextPageWithLayout<T, T>,options?: {redirectTo: stringredirectIfFound?: boolean}) {- return (props: any) => {+ const WithAuthHOC: ComponentType<T> = (props: any) => {const router = useRouter()const rootStore = useStore()@@ -93,6 +94,14 @@ export function withAuth<T>(</>)}++ WithAuthHOC.displayName = `WithAuth(${WrappedComponent.displayName})`++ if ('getLayout' in WrappedComponent) {+ ;(WithAuthHOC as any).getLayout = WrappedComponent.getLayout+ }++ return WithAuthHOC}function defaultRedirectTo(ref: string | string[] | undefined) {diff --git a/studio/pages/reset-password.tsx b/studio/pages/reset-password.tsxindex 36c2428b17e..1336eaef9c0 100644--- a/studio/pages/reset-password.tsx+++ b/studio/pages/reset-password.tsx@@ -1,5 +1,6 @@import ResetPasswordForm from 'components/interfaces/SignIn/ResetPasswordForm'import { ForgotPasswordLayout } from 'components/layouts'+import { withAuth } from 'hooks'import Link from 'next/link'import { NextPageWithLayout } from 'types'@@ -29,4 +30,4 @@ ResetPasswordPage.getLayout = (page) => (</ForgotPasswordLayout>)-export default ResetPasswordPage+export default withAuth(ResetPasswordPage)diff --git a/studio/types/next.ts b/studio/types/next.tsindex b525bed86bc..04bd6659eb4 100644--- a/studio/types/next.ts+++ b/studio/types/next.ts@@ -6,6 +6,6 @@ export type AppPropsWithLayout = AppProps & {Component: NextPageWithLayout}-export type NextPageWithLayout = NextPage & {+export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {getLayout?: (page: ReactElement) => ReactNode}