diff --git a/mods/common/src/connect/validations.ts b/mods/common/src/connect/validations.ts index 033801fb7..33abbe4c9 100644 --- a/mods/common/src/connect/validations.ts +++ b/mods/common/src/connect/validations.ts @@ -38,14 +38,8 @@ export const hasUsername = (username: string) => username ? true : new BadRequestError("the username is required") export const isValidUsername = (username: string) => { - if ( - username && - (!Validator.default.isAlphanumeric(username) || - !Validator.default.isLowercase(username)) - ) { - return new BadRequestError( - "the username must be a lowercase, alphanumeric, and without spaces" - ) + if (username?.includes(" ")) { + return new BadRequestError("the username must not contain spaces") } return true } diff --git a/mods/pgdata/test/agent.mapper.unit.test.ts b/mods/pgdata/test/agent.mapper.unit.test.ts index 61516974b..58534bf89 100644 --- a/mods/pgdata/test/agent.mapper.unit.test.ts +++ b/mods/pgdata/test/agent.mapper.unit.test.ts @@ -273,9 +273,7 @@ describe("@routr/pgdata/mappers/agent", () => { const result = () => new AgentManager(agent).validOrThrowCreate() // Assert - expect(result).to.throw( - "the username must be a lowercase, alphanumeric, and without spaces" - ) + expect(result).to.throw("the username must not contain spaces") }) }) }) diff --git a/mods/pgdata/test/credentials.mapper.unit.test.ts b/mods/pgdata/test/credentials.mapper.unit.test.ts index 720df7deb..3102821f3 100644 --- a/mods/pgdata/test/credentials.mapper.unit.test.ts +++ b/mods/pgdata/test/credentials.mapper.unit.test.ts @@ -193,12 +193,8 @@ describe("@routr/pgdata/mappers/credentials", () => { new CredentialsManager(credentials).validOrThrowUpdate() // Assert - expect(createResult).to.throw( - "the username must be a lowercase, alphanumeric, and without spaces" - ) - expect(updateResult).to.throw( - "the username must be a lowercase, alphanumeric, and without spaces" - ) + expect(createResult).to.throw("the username must not contain spaces") + expect(updateResult).to.throw("the username must not contain spaces") }) it("when request is missing the password", () => { diff --git a/mods/pgdata/test/peer.mapper.unit.test.ts b/mods/pgdata/test/peer.mapper.unit.test.ts index 4e12ad4bf..21da46869 100644 --- a/mods/pgdata/test/peer.mapper.unit.test.ts +++ b/mods/pgdata/test/peer.mapper.unit.test.ts @@ -266,9 +266,7 @@ describe("@routr/pgdata/mappers/peer", () => { const result = () => new PeerManager(peer).validOrThrowCreate() // Assert - expect(result).to.throw( - "the username must be a lowercase, alphanumeric, and without spaces" - ) + expect(result).to.throw("the username must not contain spaces") }) it("when the request is missing the aor", () => {