From 2b2c60cbe3f4612d0309a2cc9a115126629a7231 Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Fri, 30 Apr 2021 10:51:23 +0200 Subject: [PATCH 1/2] allow numbers in nickname again closes #972 --- front/src/Connexion/LocalUser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } From 7592a71bd56a2ea62de37e54b4bb141ecf70b738 Mon Sep 17 00:00:00 2001 From: TabascoEye Date: Fri, 30 Apr 2021 10:58:01 +0200 Subject: [PATCH 2/2] remove test case with numbers being invalid in nickname --- front/tests/Phaser/Connexion/LocalUserTest.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) 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 +});