File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ export function AuthPage() {
5757
5858 const canSubmit =
5959 email . trim ( ) . length > 0 &&
60- password . trim ( ) . length >= 8 &&
61- ( mode === "sign_in" || name . trim ( ) . length > 0 ) ;
60+ password . trim ( ) . length > 0 &&
61+ ( mode === "sign_in" || ( name . trim ( ) . length > 0 && password . trim ( ) . length >= 8 ) ) ;
6262
6363 if ( isSessionLoading ) {
6464 return (
@@ -91,6 +91,11 @@ export function AuthPage() {
9191 className = "mt-6 space-y-4"
9292 onSubmit = { ( event ) => {
9393 event . preventDefault ( ) ;
94+ if ( mutation . isPending ) return ;
95+ if ( ! canSubmit ) {
96+ setError ( "Please fill in all required fields." ) ;
97+ return ;
98+ }
9499 mutation . mutate ( ) ;
95100 } }
96101 >
@@ -128,7 +133,12 @@ export function AuthPage() {
128133 />
129134 </ div >
130135 { error && < p className = "text-xs text-destructive" > { error } </ p > }
131- < Button type = "submit" disabled = { ! canSubmit || mutation . isPending } className = "w-full" >
136+ < Button
137+ type = "submit"
138+ disabled = { mutation . isPending }
139+ aria-disabled = { ! canSubmit || mutation . isPending }
140+ className = { `w-full ${ ! canSubmit && ! mutation . isPending ? "opacity-50" : "" } ` }
141+ >
132142 { mutation . isPending
133143 ? "Working…"
134144 : mode === "sign_in"
You can’t perform that action at this time.
0 commit comments