Skip to content

Commit 63ff703

Browse files
authored
Chore/standardize password criteria (FlowiseAI#4550)
standardize password criteria
1 parent a88337c commit 63ff703

File tree

8 files changed

+14
-10
lines changed

8 files changed

+14
-10
lines changed

packages/server/src/enterprise/Interface.Enterprise.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,10 @@ export const OrgSetupSchema = z
104104
password: z
105105
.string()
106106
.min(8, 'Password must be at least 8 characters')
107+
.regex(/[a-z]/, 'Password must contain at least one lowercase letter')
107108
.regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
108-
.regex(/[!@#$%^&*]/, 'Password must contain at least one special character'),
109+
.regex(/\d/, 'Password must contain at least one digit')
110+
.regex(/[^a-zA-Z0-9]/, 'Password must contain at least one special character'),
109111
confirmPassword: z.string().min(1, 'Confirm Password is required')
110112
})
111113
.refine((data) => data.password === data.confirmPassword, {
@@ -122,8 +124,10 @@ export const RegisterUserSchema = z
122124
password: z
123125
.string()
124126
.min(8, 'Password must be at least 8 characters')
127+
.regex(/[a-z]/, 'Password must contain at least one lowercase letter')
125128
.regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
126-
.regex(/[!@#$%^&*]/, 'Password must contain at least one special character'),
129+
.regex(/\d/, 'Password must contain at least one digit')
130+
.regex(/[^a-zA-Z0-9]/, 'Password must contain at least one special character'),
127131
confirmPassword: z.string().min(1, 'Confirm Password is required'),
128132
token: z.string().min(1, 'Invite Code is required')
129133
})

packages/server/src/enterprise/utils/validation.util.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ export function isInvalidDateTime(dateTime: unknown): boolean {
1818
}
1919

2020
export function isInvalidPassword(password: unknown): boolean {
21-
const regexPassword = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&-])[A-Za-z\d@$!%*?&-]{8,}$/
21+
const regexPassword = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^a-zA-Z0-9]).{8,}$/
2222
return !password || typeof password !== 'string' || !regexPassword.test(password)
2323
}

packages/ui/src/utils/validation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export const passwordSchema = z
66
.regex(/[a-z]/, 'Password must contain at least one lowercase letter')
77
.regex(/[A-Z]/, 'Password must contain at least one uppercase letter')
88
.regex(/\d/, 'Password must contain at least one digit')
9-
.regex(/[@$!%*?&-]/, 'Password must contain at least one special character (@$!%*?&-)')
9+
.regex(/[^a-zA-Z0-9]/, 'Password must contain at least one special character')
1010

1111
export const validatePassword = (password) => {
1212
const result = passwordSchema.safeParse(password)

packages/ui/src/views/account/UserProfile.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ const UserProfile = () => {
257257
<Typography variant='caption'>
258258
<i>
259259
Password must be at least 8 characters long and contain at least one lowercase letter, one
260-
uppercase letter, one digit, and one special character (@$!%*?&-).
260+
uppercase letter, one digit, and one special character.
261261
</i>
262262
</Typography>
263263
</Box>

packages/ui/src/views/account/index.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ const AccountSettings = () => {
791791
<Typography variant='caption'>
792792
<i>
793793
Password must be at least 8 characters long and contain at least one lowercase letter,
794-
one uppercase letter, one digit, and one special character (@$!%*?&-).
794+
one uppercase letter, one digit, and one special character.
795795
</i>
796796
</Typography>
797797
</Box>

packages/ui/src/views/auth/register.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ const RegisterPage = () => {
359359
<Typography variant='caption'>
360360
<i>
361361
Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase
362-
letter, one digit, and one special character (@$!%*?&-).
362+
letter, one digit, and one special character.
363363
</i>
364364
</Typography>
365365
</Box>

packages/ui/src/views/auth/resetPassword.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ const ResetPasswordPage = () => {
220220
<Typography variant='caption'>
221221
<i>
222222
Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase
223-
letter, one digit, and one special character (@$!%*?&-).
223+
letter, one digit, and one special character.
224224
</i>
225225
</Typography>
226226
</Box>

packages/ui/src/views/organization/index.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ const OrganizationSetupPage = () => {
172172
if (isEnterpriseLicensed) {
173173
finalErrMessage = `Error in registering organization. Please contact your administrator. (${errMessage})`
174174
} else {
175-
finalErrMessage = `Error in registering account.`
175+
finalErrMessage = `Error in registering account: ${errMessage}`
176176
}
177177
setAuthError(finalErrMessage)
178178
setLoading(false)
@@ -396,7 +396,7 @@ const OrganizationSetupPage = () => {
396396
<Typography variant='caption'>
397397
<i>
398398
Password must be at least 8 characters long and contain at least one lowercase letter, one uppercase
399-
letter, one digit, and one special character (@$!%*?&-).
399+
letter, one digit, and one special character.
400400
</i>
401401
</Typography>
402402
</Box>

0 commit comments

Comments
 (0)