@@ -30,6 +30,7 @@ import { isEmpty } from '@/utils';
30
30
import { wrapOnChange } from '@/utils/form' ;
31
31
32
32
import { getOauthSourceFromParams } from '#/domain/auth/helper' ;
33
+ import HumanProofWidget from '#/domain/auth/widgets/human-proof' ;
33
34
import { signin , emailCodeLogin } from '#/services/auth' ;
34
35
35
36
import LoginTypeSwitcher from './LoginTypeSwitcher' ;
@@ -44,6 +45,7 @@ export default function Login() {
44
45
const emailFieldName = 'Email' ;
45
46
const searchParams = useSearchParams ( ) ;
46
47
const [ loading , setLoading ] = useState ( false ) ;
48
+ const [ humanVerified , setHumanVerified ] = useState ( false ) ;
47
49
const [ passwordType , setPasswordType ] = useState ( 'password' ) ;
48
50
const [ loginType , setLoginType ] = useState ( 'verifyCode' ) ;
49
51
@@ -155,6 +157,7 @@ export default function Login() {
155
157
< button
156
158
type = "submit"
157
159
disabled = {
160
+ ! humanVerified ||
158
161
! watchAllFields . Email ||
159
162
( loginType === 'password' && ! watchAllFields . Password ) ||
160
163
( loginType === 'verifyCode' && ! watchAllFields . VerifyCode ) ||
@@ -166,20 +169,18 @@ export default function Login() {
166
169
< span > Continue</ span >
167
170
</ button >
168
171
</ form >
169
-
172
+ < HumanProofWidget onVerify = { setHumanVerified } />
170
173
{ ! isEmpty ( errors ) && watchAllFields . Email !== '' && (
171
174
< p className = "mt-4 text-xs text-center text-red" >
172
175
{ loginType === 'password'
173
176
? 'The email or password is wrong.'
174
177
: 'The email or code is wrong.' }
175
178
</ p >
176
179
) }
177
-
178
180
< LoginTypeSwitcher
179
181
loginType = { loginType }
180
182
handleChangeLoginType = { handleChangeLoginType }
181
183
/>
182
-
183
184
{ loginType == 'password' && (
184
185
< div className = "mt-6 text-center" >
185
186
Forget your password?
0 commit comments