Skip to content

Commit

Permalink
Usernames cannot contain "system message"
Browse files Browse the repository at this point in the history
  • Loading branch information
shayypy committed Jul 6, 2023
1 parent eeb17c9 commit b7d7811
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion common/form/validators/isUsername.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export const isUsername = () => {
return (value: string): string | false => {
for (const forbidden of ["discord", "```"]) {
for (const forbidden of ["discord", "```", "system message"]) {
if (value.toLowerCase().includes(forbidden)) {
return `Username cannot contain "${forbidden}"`
}
Expand Down
4 changes: 2 additions & 2 deletions modules/editor/data/validation/isUsername.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import { isString } from "./isString"
import type { Validator } from "./Validator"

export const isUsername: Validator = first(isString, (value, key) =>
!/(^(everyone|here)$)|discord|```/i.test(value as string)
!/(^(everyone|here)$)|discord|```|system message/i.test(value as string)
? []
: [
`${key}: Cannot be "here" or "everyone", cannot contain "discord" or "\`\`\`"`,
`${key}: Cannot contain "discord", "system message", or "\`\`\`", and cannot be "here" or "everyone"`,
],
)

0 comments on commit b7d7811

Please sign in to comment.