mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Chore/standardize password criteria (#4550)
standardize password criteria
This commit is contained in:
@@ -104,8 +104,10 @@ export const OrgSetupSchema = z
|
||||
password: z
|
||||
.string()
|
||||
.min(8, 'Password must be at least 8 characters')
|
||||
.regex(/[a-z]/, 'Password must contain at least one lowercase letter')
|
||||
.regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
|
||||
.regex(/[!@#$%^&*]/, 'Password must contain at least one special character'),
|
||||
.regex(/\d/, 'Password must contain at least one digit')
|
||||
.regex(/[^a-zA-Z0-9]/, 'Password must contain at least one special character'),
|
||||
confirmPassword: z.string().min(1, 'Confirm Password is required')
|
||||
})
|
||||
.refine((data) => data.password === data.confirmPassword, {
|
||||
@@ -122,8 +124,10 @@ export const RegisterUserSchema = z
|
||||
password: z
|
||||
.string()
|
||||
.min(8, 'Password must be at least 8 characters')
|
||||
.regex(/[a-z]/, 'Password must contain at least one lowercase letter')
|
||||
.regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
|
||||
.regex(/[!@#$%^&*]/, 'Password must contain at least one special character'),
|
||||
.regex(/\d/, 'Password must contain at least one digit')
|
||||
.regex(/[^a-zA-Z0-9]/, 'Password must contain at least one special character'),
|
||||
confirmPassword: z.string().min(1, 'Confirm Password is required'),
|
||||
token: z.string().min(1, 'Invite Code is required')
|
||||
})
|
||||
|
||||
@@ -18,6 +18,6 @@ export function isInvalidDateTime(dateTime: unknown): boolean {
|
||||
}
|
||||
|
||||
export function isInvalidPassword(password: unknown): boolean {
|
||||
const regexPassword = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&-])[A-Za-z\d@$!%*?&-]{8,}$/
|
||||
const regexPassword = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).{8,}$/
|
||||
return !password || typeof password !== 'string' || !regexPassword.test(password)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user