Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
validate password is match
Browse files Browse the repository at this point in the history
  • Loading branch information
billowdev committed May 23, 2023
1 parent 8f2ba5d commit 2e93452
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/pages/panel/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ function UserPanelProfile({
const [passwordConfirmation, setPasswordConfirmation] = React.useState('');
const [isPasswordValid, setIsPasswordValid] = React.useState(true);

const passwordRegex = /^(?=.*[a-zA-Z])(?=.*\d)[A-Za-z\d]{8,}$/;
// const passwordRegex = /^(?=.*[a-zA-Z])(?=.*\d)[A-Za-z\d]{8,}$/;

const validatePassword = () => {
if (!passwordRegex.test(password)) {
toast.error('รหัสผ่านต้องประกอบด้วยตัวอักษรและตัวเลข อย่างน้อย 8 ตัว');
return false;
}
// if (!passwordRegex.test(password)) {
// toast.error('รหัสผ่านต้องประกอบด้วยตัวอักษรและตัวเลข อย่างน้อย 8 ตัว');
// return false;
// }

const isValid = password === passwordConfirmation;
setIsPasswordValid(isValid);
Expand Down

0 comments on commit 2e93452

Please sign in to comment.