Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
fix(registration): Make Username optional (#831)
Danny Avila37347d46838f
diff --git a/api/models/User.js b/api/models/User.jsindex f7d07ade22..bcbc141f1e 100644--- a/api/models/User.js+++ b/api/models/User.js@@ -24,9 +24,7 @@ const userSchema = mongoose.Schema(username: {type: String,lowercase: true,- required: [true, 'can\'t be blank'],- match: [/^[a-zA-Z0-9_.-]+$/, 'is invalid'],- index: true,+ default: '',},email: {type: String,@@ -173,12 +171,13 @@ module.exports.validateUser = (user) => {});const schema = {avatar: Joi.any(),- name: Joi.string().min(2).max(80).required(),+ name: Joi.string().min(3).max(80).required(),username: Joi.string()+ .trim()+ .allow('').min(2).max(80)- .regex(/^[a-zA-Z0-9_.-]+$/)- .required(),+ .regex(/^[a-zA-Z0-9_.-@#$%&*() ]+$/),password: Joi.string().min(8).max(128).allow('').allow(null),};diff --git a/api/strategies/validators.js b/api/strategies/validators.jsindex f105cae9b4..272c47599c 100644--- a/api/strategies/validators.js+++ b/api/strategies/validators.js@@ -6,13 +6,13 @@ const loginSchema = Joi.object().keys({});const registerSchema = Joi.object().keys({- name: Joi.string().trim().min(2).max(30).required(),+ name: Joi.string().trim().min(3).max(80).required(),username: Joi.string().trim()+ .allow('').min(2)- .max(20)- .regex(/^[a-zA-Z0-9_.-]+$/)- .required(),+ .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(),diff --git a/client/src/components/Auth/Registration.tsx b/client/src/components/Auth/Registration.tsxindex 47286f163d..cd4a4399e1 100644--- a/client/src/components/Auth/Registration.tsx+++ b/client/src/components/Auth/Registration.tsx@@ -115,13 +115,13 @@ function Registration() {id="username"aria-label={localize('com_auth_username')}{...register('username', {- required: localize('com_auth_username_required'),+ // required: localize('com_auth_username_required'),minLength: {- value: 3,+ value: 2,message: localize('com_auth_username_min_length'),},maxLength: {- value: 20,+ value: 80,message: localize('com_auth_username_max_length'),},})}diff --git a/client/src/components/Auth/__tests__/Registration.spec.tsx b/client/src/components/Auth/__tests__/Registration.spec.tsxindex 2b86c9fa0c..7c7bbd230d 100644--- a/client/src/components/Auth/__tests__/Registration.spec.tsx+++ b/client/src/components/Auth/__tests__/Registration.spec.tsx@@ -114,7 +114,7 @@ test('shows validation error messages', async () => {const alerts = getAllByRole('alert');expect(alerts).toHaveLength(5);expect(alerts[0]).toHaveTextContent(/Name must be at least 3 characters/i);- expect(alerts[1]).toHaveTextContent(/Username must be at least 3 characters/i);+ expect(alerts[1]).toHaveTextContent(/Username must be at least 2 characters/i);expect(alerts[2]).toHaveTextContent(/You must enter a valid email address/i);expect(alerts[3]).toHaveTextContent(/Password must be at least 8 characters/i);expect(alerts[4]).toHaveTextContent(/Passwords do not match/i);diff --git a/client/src/localization/languages/Eng.tsx b/client/src/localization/languages/Eng.tsxindex 28264338dc..1288824028 100644--- a/client/src/localization/languages/Eng.tsx+++ b/client/src/localization/languages/Eng.tsx@@ -57,9 +57,9 @@ export default {com_auth_name_required: 'Name is required',com_auth_name_min_length: 'Name must be at least 3 characters',com_auth_name_max_length: 'Name must be less than 80 characters',- com_auth_username: 'Username',+ com_auth_username: 'Username (optional)',com_auth_username_required: 'Username is required',- com_auth_username_min_length: 'Username must be at least 3 characters',+ com_auth_username_min_length: 'Username must be at least 2 characters',com_auth_username_max_length: 'Username must be less than 20 characters',com_auth_already_have_account: 'Already have an account?',com_auth_login: 'Login',