mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00

* fix(User.js): update validation schema for username field, allow empty string as a valid value fix(validators.js): update validation schema for username field, allow empty string as a valid value fix(Registration.tsx, validators.js): update validation rules for name and username fields, change minimum length to 2 and maximum length to 80, assure they match and allow empty string as a valid value fix(Eng.tsx): update localization string for com_auth_username, indicate that it is optional * fix(User.js): update regex pattern for username validation to allow special characters @#$%&*() fix(validators.js): update regex pattern for username validation to allow special characters @#$%&*() * fix(Registration.spec.tsx): fix validation error message for username length requirement
24 lines
637 B
JavaScript
24 lines
637 B
JavaScript
const Joi = require('joi');
|
|
|
|
const loginSchema = Joi.object().keys({
|
|
email: Joi.string().trim().email().required(),
|
|
password: Joi.string().trim().min(8).max(128).required(),
|
|
});
|
|
|
|
const registerSchema = Joi.object().keys({
|
|
name: Joi.string().trim().min(3).max(80).required(),
|
|
username: Joi.string()
|
|
.trim()
|
|
.allow('')
|
|
.min(2)
|
|
.max(80)
|
|
.regex(/^[a-zA-Z0-9_.-@#$%&*() ]+$/),
|
|
email: Joi.string().trim().email().required(),
|
|
password: Joi.string().trim().min(8).max(128).required(),
|
|
confirm_password: Joi.string().trim().min(8).max(128).required(),
|
|
});
|
|
|
|
module.exports = {
|
|
loginSchema,
|
|
registerSchema,
|
|
};
|