mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-10 12:42:44 +01:00
Respect register_dateOfBirth_required = false
This commit is contained in:
parent
911d7b0889
commit
ad1aafa7c6
@ -128,7 +128,7 @@ router.post("/", route({ body: "RegisterSchema" }), async (req: Request, res: Re
|
|||||||
throw FieldErrors({
|
throw FieldErrors({
|
||||||
date_of_birth: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") }
|
date_of_birth: { code: "BASE_TYPE_REQUIRED", message: req.t("common:field.BASE_TYPE_REQUIRED") }
|
||||||
});
|
});
|
||||||
} else if (register.dateOfBirth.minimum) {
|
} else if (register.dateOfBirth.required && register.dateOfBirth.minimum) {
|
||||||
const minimum = new Date();
|
const minimum = new Date();
|
||||||
minimum.setFullYear(minimum.getFullYear() - register.dateOfBirth.minimum);
|
minimum.setFullYear(minimum.getFullYear() - register.dateOfBirth.minimum);
|
||||||
body.date_of_birth = new Date(body.date_of_birth as Date);
|
body.date_of_birth = new Date(body.date_of_birth as Date);
|
||||||
|
@ -324,7 +324,7 @@ export const DefaultConfigOptions: ConfigValue = {
|
|||||||
// domains: fs.readFileSync(__dirname + "/blockedEmailDomains.txt", { encoding: "utf8" }).split("\n"),
|
// domains: fs.readFileSync(__dirname + "/blockedEmailDomains.txt", { encoding: "utf8" }).split("\n"),
|
||||||
},
|
},
|
||||||
dateOfBirth: {
|
dateOfBirth: {
|
||||||
required: false,
|
required: true,
|
||||||
minimum: 13,
|
minimum: 13,
|
||||||
},
|
},
|
||||||
disabled: false,
|
disabled: false,
|
||||||
|
Loading…
Reference in New Issue
Block a user