From 016ea6235d327118e9f235e575dcf276532fcde2 Mon Sep 17 00:00:00 2001 From: Alex Cheung Date: Wed, 19 Jun 2024 15:34:57 +0800 Subject: [PATCH] update check captcha --- .../auth-forms/CustomFormWizard.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/pages/authentication/auth-forms/CustomFormWizard.js b/src/pages/authentication/auth-forms/CustomFormWizard.js index a6104ec..6ad39f6 100644 --- a/src/pages/authentication/auth-forms/CustomFormWizard.js +++ b/src/pages/authentication/auth-forms/CustomFormWizard.js @@ -188,7 +188,9 @@ const CustomFormWizard = (props) => { } const checkDataField = (data) => { - if (data.username !== "" && + // console.log(data) + if (handleCaptcha(data.captchaField) && + data.username !== "" && data.password !== "" && data.confirmPassword !== "" && data.password == data.confirmPassword && @@ -205,13 +207,12 @@ const CustomFormWizard = (props) => { data.phoneCountryCode !== "" && termsAndConAccept == true && fileList.length !== 0 && - data.captchaField && + // data.captchaField && handlePassword(data.password) && handleEmail(data.email) && handleIdNo(data.idNo, selectedIdDocType.type, data.checkDigit) && handlePhone(data.phone) && handleUsername(data.username) && - handleCaptcha(data.captchaField) && !checkUsername && !checkEmail ) { @@ -443,7 +444,12 @@ const CustomFormWizard = (props) => { } function handleCaptcha(captchaField) { - return captchaField; + // console.log(captchaField.length) + if (captchaField.length == 5 ){ + return true + } else { + return false + } } function handleIdNo(idNo, selectedIdDocType, checkDigit) { @@ -672,7 +678,7 @@ const CustomFormWizard = (props) => { // faxCountryCode: yup.string().min(3,'請輸入3位數字'), phone: yup.string().min(8, displayErrorMsg(intl.formatMessage({ id: 'requireAtLeast8Number' }))).required(displayErrorMsg(intl.formatMessage({ id: 'requireContactNumber' }))), // fax: yup.string().min(8,'請輸入8位數字'), - captchaField: yup.string().max(5, getMaxErrStr(5)).required(displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), + captchaField: yup.string().max(5, getMaxErrStr(5)).required(displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))).min(5, displayErrorMsg(intl.formatMessage({ id: 'requireVerify' }))),//.oneOf([captcha], displayErrorMsg('請輸入有效驗證')), }), });