diff --git a/front/src/Connexion/LocalUser.ts b/front/src/Connexion/LocalUser.ts index 56483976..0793a938 100644 --- a/front/src/Connexion/LocalUser.ts +++ b/front/src/Connexion/LocalUser.ts @@ -10,7 +10,7 @@ export interface CharacterTexture { export const maxUserNameLength: number = MAX_USERNAME_LENGTH; export function isUserNameValid(value: string): boolean { - const regexp = new RegExp('^[A-Za-z]{1,'+maxUserNameLength+'}$'); + const regexp = new RegExp('^[A-Za-z0-9]{1,'+maxUserNameLength+'}$'); return regexp.test(value); } diff --git a/front/tests/Phaser/Connexion/LocalUserTest.ts b/front/tests/Phaser/Connexion/LocalUserTest.ts index 00d8f400..25b54005 100644 --- a/front/tests/Phaser/Connexion/LocalUserTest.ts +++ b/front/tests/Phaser/Connexion/LocalUserTest.ts @@ -19,9 +19,6 @@ describe("isUserNameValid()", () => { it("should not validate spaces", () => { expect(isUserNameValid(' ')).toBe(false); }); - it("should not validate numbers", () => { - expect(isUserNameValid('a12')).toBe(false); - }); it("should not validate special characters", () => { expect(isUserNameValid('a&-')).toBe(false); }); @@ -42,4 +39,4 @@ describe("areCharacterLayersValid()", () => { it("should not validate empty strings", () => { expect(areCharacterLayersValid(['', 'male1'])).toBe(false); }); -}); \ No newline at end of file +});