Turnstile
This commit is contained in:
@@ -7,7 +7,7 @@ INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API="https://devapi.mermsemr.com"
|
||||
# REACT_APP_MAIN_API="http://localhost:14700"
|
||||
#REACT_APP_MAIN_API="http://localhost:14700"
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
@@ -20,4 +20,6 @@ VITE_BANK_NAME_SHORT='FCMB'
|
||||
# Inactivity timeout/logout AT 10MINS
|
||||
REACT_APP_TIMEOUT=600000
|
||||
|
||||
#CLOUDFLARE
|
||||
REACT_APP_TURNSTILE_SITE_KEY=0x4AAAAAADQV82wuocFR-u5O
|
||||
|
||||
|
||||
+4
-1
@@ -18,4 +18,7 @@ VITE_BANK_NAME='First City Monument Bank'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
|
||||
# Inactivity timeout/logout AT 10MINS
|
||||
REACT_APP_TIMEOUT=600000
|
||||
REACT_APP_TIMEOUT=600000
|
||||
|
||||
#CLOUDFLARE
|
||||
REACT_APP_TURNSTILE_SITE_KEY=0x4AAAAAADQV82wuocFR-u5O
|
||||
|
||||
+6
-3
@@ -6,8 +6,8 @@ TWITTER_URL=https://twitter.com
|
||||
INSTAGRAM_URL=https://www.instagram.com
|
||||
|
||||
# BACKEND END POINTS
|
||||
REACT_APP_MAIN_API="https://api.mermsemr.com"
|
||||
#REACT_APP_MAIN_API="http://localhost:14700"
|
||||
# REACT_APP_MAIN_API="https://api.mermsemr.com"
|
||||
REACT_APP_MAIN_API="http://localhost:14700"
|
||||
|
||||
# ENQUIRIES CONTACTS
|
||||
VITE_CALL_ENDPOINT='09099000000'
|
||||
@@ -18,4 +18,7 @@ VITE_BANK_NAME='First City Monument Bank'
|
||||
VITE_BANK_NAME_SHORT='FCMB'
|
||||
|
||||
# Inactivity timeout/logout AT 10MINS
|
||||
REACT_APP_TIMEOUT=600000
|
||||
REACT_APP_TIMEOUT=600000
|
||||
|
||||
#CLOUDFLARE
|
||||
REACT_APP_TURNSTILE_SITE_KEY=0x4AAAAAADQV82wuocFR-u5O
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"dependencies": {
|
||||
"@reduxjs/toolkit": "^2.5.1",
|
||||
"@tanstack/react-query": "^5.66.0",
|
||||
"@marsidev/react-turnstile": "^1.5.2",
|
||||
"apexcharts": "^4.5.0",
|
||||
"axios": "^1.7.9",
|
||||
"cra-template": "1.2.0",
|
||||
|
||||
@@ -4,6 +4,7 @@ import {useNavigate} from 'react-router-dom'
|
||||
import {useMutation} from '@tanstack/react-query'
|
||||
import {Formik, Form} from 'formik'
|
||||
import * as Yup from "yup";
|
||||
import {Turnstile} from '@marsidev/react-turnstile'
|
||||
|
||||
import InputText from '../InputText'
|
||||
import {updateUserDetails} from "../../store/UserDetails";
|
||||
@@ -30,6 +31,7 @@ export default function LoginCom() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [turnstileToken, setTurnstileToken] = useState(null)
|
||||
|
||||
const login = useMutation({
|
||||
mutationFn: (fields) => {
|
||||
@@ -53,9 +55,9 @@ export default function LoginCom() {
|
||||
})
|
||||
|
||||
//FUNCTION TO HANDLE LOGIN
|
||||
const handleSubmit = (values, helper) => {
|
||||
login.mutate(values)
|
||||
// handleLogin()
|
||||
const handleSubmit = (values) => {
|
||||
if (!turnstileToken) return
|
||||
login.mutate({...values, cf_turnstile_response: turnstileToken})
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -107,9 +109,17 @@ export default function LoginCom() {
|
||||
/>
|
||||
{/* <p className='text-sm text-end font-medium text-primary'>Forget password ?</p> */}
|
||||
</div>
|
||||
<div className="text-center col-12 mt-3">
|
||||
<Turnstile
|
||||
siteKey={process.env.REACT_APP_TURNSTILE_SITE_KEY}
|
||||
onSuccess={setTurnstileToken}
|
||||
onExpire={() => setTurnstileToken(null)}
|
||||
onError={() => setTurnstileToken(null)}
|
||||
/>
|
||||
</div>
|
||||
<div className='h-10 mb-10'>
|
||||
<button type='submit' disabled={login.isPending}
|
||||
className='w-full h-full bg-primary text-white font-bold rounded-md'>{login.isPending || loading ? 'loading...' : 'Login'}</button>
|
||||
<button type='submit' disabled={login.isPending || !turnstileToken}
|
||||
className='w-full h-full bg-primary text-white font-bold rounded-md disabled:opacity-50 disabled:cursor-not-allowed'>{login.isPending || loading ? 'loading...' : 'Login'}</button>
|
||||
</div>
|
||||
|
||||
{login.error &&
|
||||
|
||||
Reference in New Issue
Block a user