Skip to content

Commit 9a54f8a

Browse files
committed
fix: cannot use "password" format (#766)
1 parent 64699e3 commit 9a54f8a

File tree

8 files changed

+10
-10
lines changed

8 files changed

+10
-10
lines changed

src/plugins/Ajv.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ const directoryPath: FormatDefinition<string> = {
101101
},
102102
};
103103

104-
const password: FormatDefinition<string> = {
104+
const userPassword: FormatDefinition<string> = {
105105
validate: str => {
106106
// 8..32 characters, at least one letter and one number
107107
return 8 <= str.length && str.length <= 32 && /[a-z]/i.test(str) && /\d/.test(str);
@@ -130,7 +130,7 @@ export const ajvSelfPlugin = (ajv: Ajv): void => {
130130
ajv.addFormat("phone", phone);
131131
ajv.addFormat("directory-name", directoryName);
132132
ajv.addFormat("directory-path", directoryPath);
133-
ajv.addFormat("password", password);
133+
ajv.addFormat("user-password", userPassword);
134134
ajv.addFormat("email", email);
135135
};
136136

src/v2/controllers/login/email/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const loginEmailSchema = {
1212
format: "email",
1313
}),
1414
password: Type.String({
15-
format: "password",
15+
format: "user-password",
1616
minLength: 8,
1717
maxLength: 32,
1818
}),

src/v2/controllers/login/phone/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const loginPhoneSchema = {
1010
{
1111
phone: Type.String(),
1212
password: Type.String({
13-
format: "password",
13+
format: "user-password",
1414
minLength: 8,
1515
maxLength: 32,
1616
}),

src/v2/controllers/register/email/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const registerEmailSchema = {
1313
}),
1414
code: Type.Integer(),
1515
password: Type.String({
16-
format: "password",
16+
format: "user-password",
1717
minLength: 8,
1818
maxLength: 32,
1919
}),

src/v2/controllers/register/phone/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const registerPhoneSchema = {
1111
phone: Type.String(),
1212
code: Type.Integer(),
1313
password: Type.String({
14-
format: "password",
14+
format: "user-password",
1515
minLength: 8,
1616
maxLength: 32,
1717
}),

src/v2/controllers/reset/email/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const resetEmailSchema = {
1111
}),
1212
code: Type.Integer(),
1313
password: Type.String({
14-
format: "password",
14+
format: "user-password",
1515
minLength: 8,
1616
maxLength: 32,
1717
}),

src/v2/controllers/reset/phone/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export const resetPhoneSchema = {
99
phone: Type.String(),
1010
code: Type.Integer(),
1111
password: Type.String({
12-
format: "password",
12+
format: "user-password",
1313
minLength: 8,
1414
maxLength: 32,
1515
}),

src/v2/controllers/user/password/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ export const userPasswordSchema = {
88
{
99
password: Type.Optional(
1010
Type.String({
11-
format: "password",
11+
format: "user-password",
1212
minLength: 8,
1313
maxLength: 32,
1414
}),
1515
),
1616
newPassword: Type.String({
17-
format: "password",
17+
format: "user-password",
1818
minLength: 8,
1919
maxLength: 32,
2020
}),

0 commit comments

Comments
 (0)