@@ -23,6 +23,7 @@ import Logo from 'public/images/svg/logo-black.svg';
23
23
import { useEffect , useState } from 'react' ;
24
24
25
25
import { Button } from '@/components/Button' ;
26
+ import CloudflareTurnstile from '@/components/control/cf-turnstile' ;
26
27
import { SvgIcon } from '@/components/Image' ;
27
28
import Loader from '@/components/Loader' ;
28
29
import useMounted from '@/hooks/useMounted' ;
@@ -43,7 +44,7 @@ export default function Page() {
43
44
44
45
const { status } = useSession ( ) ;
45
46
46
- const [ disabled , setDisabled ] = useState ( false ) ;
47
+ const [ disabled , setDisabled ] = useState ( true ) ;
47
48
const [ loading , setLoading ] = useState ( true ) ;
48
49
const [ clientInfo , setClientInfo ] = useState ( null ) ;
49
50
@@ -92,14 +93,22 @@ export default function Page() {
92
93
}
93
94
} , [ status ] ) ; // eslint-disable-line react-hooks/exhaustive-deps
94
95
96
+ const handleVerify = token => {
97
+ if ( ! token ) {
98
+ return ;
99
+ }
100
+
101
+ setDisabled ( false ) ;
102
+ } ;
103
+
95
104
return (
96
105
loading ? < Loader /> : (
97
106
< div className = "flex min-h-screen flex-col items-center pt-9 md:pt-[60px] p-4 font-['Nunito_Sans'] relative" >
98
107
< div className = "relative w-[192px] md:w-[320px]" >
99
108
< div className = "absolute top-1/2 left-0 w-full border-b-2 border-dashed border-[#d1d9e0]" />
100
109
< div className = "flex items-center justify-between py-9" >
101
110
< div className = "relative bg-white rounded-full size-[60px] md:size-[100px]" >
102
- < img src = { clientInfo ?. icon } alt = "Logo" className = "!size-full" />
111
+ < Image src = { clientInfo ?. icon } alt = "Logo" className = "!size-full" fill />
103
112
</ div >
104
113
< div className = "flex items-center gap-2 relative" >
105
114
< SvgIcon name = "circle-check" size = { 20 } />
@@ -123,13 +132,16 @@ export default function Page() {
123
132
< NoteItem icon = "personal" title = "Personal user data" description = "Email addresses (read-only), profile information (read-only)" />
124
133
< NoteItem icon = "international" title = "Public data only" description = "Limited access to your public data" />
125
134
</ div >
126
- < div className = "flex gap-3 border-y border-gray-600 p-6 mx-[-24px]" >
127
- < Button variant = "outlined" className = "flex-1" onClick = { handleCancel } >
128
- Cancel
129
- </ Button >
130
- < Button variant = "contained" className = "flex-1" onClick = { authorize } disabled = { disabled } >
131
- Authorize
132
- </ Button >
135
+ < div className = "mx-[-24px] p-6 border-y border-gray-600" >
136
+ < CloudflareTurnstile className = "mb-2" onVerify = { handleVerify } />
137
+ < div className = "flex gap-3" >
138
+ < Button variant = "outlined" className = "flex-1" onClick = { handleCancel } >
139
+ Cancel
140
+ </ Button >
141
+ < Button variant = "contained" className = "flex-1" onClick = { authorize } disabled = { disabled } >
142
+ Authorize
143
+ </ Button >
144
+ </ div >
133
145
</ div >
134
146
< div className = "pt-6 flex items-center gap-3" >
135
147
< SvgIcon name = "lock" size = { 16 } />
0 commit comments