@@ -4,6 +4,8 @@ import { ArrowRight } from "@phosphor-icons/react";
4
4
import { loginSchema } from "@reactive-resume/dto" ;
5
5
import { usePasswordToggle } from "@reactive-resume/hooks" ;
6
6
import {
7
+ Alert ,
8
+ AlertTitle ,
7
9
Button ,
8
10
Form ,
9
11
FormControl ,
@@ -22,15 +24,13 @@ import { Link } from "react-router-dom";
22
24
import { z } from "zod" ;
23
25
24
26
import { useLogin } from "@/client/services/auth" ;
25
- import { useAuthProviders } from "@/client/services/auth/providers " ;
27
+ import { useFeatureFlags } from "@/client/services/feature " ;
26
28
27
29
type FormValues = z . infer < typeof loginSchema > ;
28
30
29
31
export const LoginPage = ( ) => {
30
32
const { login, loading } = useLogin ( ) ;
31
-
32
- const { providers } = useAuthProviders ( ) ;
33
- const emailAuthDisabled = ! providers ?. includes ( "email" ) ;
33
+ const { flags } = useFeatureFlags ( ) ;
34
34
35
35
const formRef = useRef < HTMLFormElement > ( null ) ;
36
36
usePasswordToggle ( formRef ) ;
@@ -58,7 +58,7 @@ export const LoginPage = () => {
58
58
59
59
< div className = "space-y-1.5" >
60
60
< h2 className = "text-2xl font-semibold tracking-tight" > { t `Sign in to your account` } </ h2 >
61
- < h6 className = { cn ( emailAuthDisabled && "hidden" ) } >
61
+ < h6 >
62
62
< span className = "opacity-75" > { t `Don't have an account?` } </ span >
63
63
< Button asChild variant = "link" className = "px-1.5" >
64
64
< Link to = "/auth/register" >
@@ -69,7 +69,13 @@ export const LoginPage = () => {
69
69
</ h6 >
70
70
</ div >
71
71
72
- < div className = { cn ( emailAuthDisabled && "hidden" ) } >
72
+ { flags . isEmailAuthDisabled && (
73
+ < Alert variant = "error" >
74
+ < AlertTitle > { t `Signing in via email is currently disabled by the administrator.` } </ AlertTitle >
75
+ </ Alert >
76
+ ) }
77
+
78
+ < div className = { cn ( flags . isEmailAuthDisabled && "pointer-events-none select-none blur-sm" ) } >
73
79
< Form { ...form } >
74
80
< form
75
81
ref = { formRef }
0 commit comments