Merge pull request #974 from tabascoeye/patch-1
allow numbers in nickname again
This commit is contained in:
commit
fea1de36a4
@ -10,7 +10,7 @@ export interface CharacterTexture {
|
|||||||
export const maxUserNameLength: number = MAX_USERNAME_LENGTH;
|
export const maxUserNameLength: number = MAX_USERNAME_LENGTH;
|
||||||
|
|
||||||
export function isUserNameValid(value: string): boolean {
|
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);
|
return regexp.test(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ describe("isUserNameValid()", () => {
|
|||||||
it("should not validate spaces", () => {
|
it("should not validate spaces", () => {
|
||||||
expect(isUserNameValid(' ')).toBe(false);
|
expect(isUserNameValid(' ')).toBe(false);
|
||||||
});
|
});
|
||||||
it("should not validate numbers", () => {
|
|
||||||
expect(isUserNameValid('a12')).toBe(false);
|
|
||||||
});
|
|
||||||
it("should not validate special characters", () => {
|
it("should not validate special characters", () => {
|
||||||
expect(isUserNameValid('a&-')).toBe(false);
|
expect(isUserNameValid('a&-')).toBe(false);
|
||||||
});
|
});
|
||||||
@ -42,4 +39,4 @@ describe("areCharacterLayersValid()", () => {
|
|||||||
it("should not validate empty strings", () => {
|
it("should not validate empty strings", () => {
|
||||||
expect(areCharacterLayersValid(['', 'male1'])).toBe(false);
|
expect(areCharacterLayersValid(['', 'male1'])).toBe(false);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user