Anna Ho 2 роки тому
джерело
коміт
5e61f67bb2
4 змінених файлів з 19 додано та 9 видалено
  1. +9
    -1
      src/pages/authentication/auth-forms/AuthLoginCustom.js
  2. +3
    -2
      src/pages/authentication/auth-forms/BusCustomFormWizard.js
  3. +5
    -4
      src/pages/authentication/auth-forms/CustomFormWizard.js
  4. +2
    -2
      src/routes/index.js

+ 9
- 1
src/pages/authentication/auth-forms/AuthLoginCustom.js Переглянути файл

@@ -97,7 +97,7 @@ const AuthLoginCustom = () => {
submit: null
}),
validationSchema:yup.object().shape({
username: yup.string().min(8,'用戶名稱最少8位').required('請輸入用戶名稱'),
username: yup.string().min(6,'用戶名稱最少6位').required('請輸入用戶名稱'),
password: yup.string().min(8,'請輸入最少8位密碼').required('請輸入密碼')
.matches(/^(?=.*[a-z])/, '請包括最少1個小寫字母')
.matches(/^(?=.*[A-Z])/, '請包括最少1個大寫字母')
@@ -176,6 +176,14 @@ const AuthLoginCustom = () => {
value={formik.values.username}
error={Boolean(formik.touched.username && formik.errors.username)}
onBlur={formik.handleBlur}
inputProps={{
maxLength: 20,
onKeyDown: (e) => {
if (e.key === 'Enter') {
e.preventDefault();
}
},
}}
/>
{formik.touched.username && formik.errors.username && (
<FormHelperText error id="standard-weight-helper-text-username-login">


+ 3
- 2
src/pages/authentication/auth-forms/BusCustomFormWizard.js Переглянути файл

@@ -91,6 +91,7 @@ const BusCustomFormWizard = (props) => {
}, []);

const checkDataField = (data)=> {
// console.log(data.brExpiryDate)
if (data.username !==""&&
data.password !==""&&
data.confirmPassword !==""&&
@@ -165,7 +166,7 @@ const BusCustomFormWizard = (props) => {
const _onSubmit = () => {
values.address4 = selectedAddress4
values.address5 = selectedAddress5
console.log(values)
// console.log(values)
const busUserAddress = {
"addressLine1":"",
"addressLine2":"",
@@ -290,7 +291,7 @@ const BusCustomFormWizard = (props) => {
brNo:'',
}),
validationSchema:yup.object().shape({
username: yup.string().min(8,"用戶名稱最少8位").required('請輸入用戶名稱'),
username: yup.string().min(6,'用戶名稱最少6位').required('請輸入用戶名稱'),
password: yup.string().min(8,'請輸入最少8位密碼').required('請輸入密碼')
.matches(/^(?=.*[a-z])/, '請包括最少1個小寫字母')
.matches(/^(?=.*[A-Z])/, '請包括最少1個大寫字母')


+ 5
- 4
src/pages/authentication/auth-forms/CustomFormWizard.js Переглянути файл

@@ -275,9 +275,10 @@ const CustomFormWizard = (props) => {
}

function handleEmail(email) {
var reg = /^\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}$/;
var result = reg.test(email);
var validRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
// var result = reg.test(email);
var result = email.match(validRegex);
console.log("test1: "+result)
if (result == false) {
return false;
}
@@ -306,7 +307,7 @@ const CustomFormWizard = (props) => {
idDocType:selectedIdDocType
}),
validationSchema:yup.object().shape({
username: yup.string().min(8,"用戶名稱最少8位").required('請輸入用戶名稱'),
username: yup.string().min(6,'用戶名稱最少6位').required('請輸入用戶名稱'),
password: yup.string().min(8,'請輸入最少8位密碼').required('請輸入密碼')
.matches(/^(?=.*[a-z])/, '請包括最少1個小寫字母')
.matches(/^(?=.*[A-Z])/, '請包括最少1個大寫字母')


+ 2
- 2
src/routes/index.js Переглянути файл

@@ -2,7 +2,7 @@
import LoginRoutes from './LoginRoutes'
import MainRoutes from './MainRoutes'
import {useRoutes} from 'react-router-dom'
import {isUserLoggedIn} from "utils/Utils";
import {isUserLoggedIn,isAdminLoggedIn} from "utils/Utils";
import {Navigate} from "react-router";
import {
setupAxiosInterceptors,
@@ -33,7 +33,7 @@ export default function ThemeRoutes() {
]
},
isUserLoggedIn() ? MainRoutes : LoginRoutes,
isUserLoggedIn() ? SettingRoutes : LoginRoutes,
isUserLoggedIn()&&isAdminLoggedIn() ? SettingRoutes : LoginRoutes,
!isUserLoggedIn()?{
path: '*',
element: <Navigate to="/login"/>


Завантаження…
Відмінити
Зберегти