mirror of
https://github.com/wassname/talk.git
synced 2026-08-03 13:20:59 +08:00
feat: expanded allowed characters in usernames to support accents (#2585)
This commit is contained in:
committed by
Kim Gardner
parent
b3064c89de
commit
6fb772944c
@@ -0,0 +1,20 @@
|
||||
import { USERNAME_REGEX } from "./validate";
|
||||
|
||||
describe("USERNAME_REGEX", () => {
|
||||
it("validates username characters", () => {
|
||||
const usernames = [
|
||||
"bill",
|
||||
"bill.smith",
|
||||
"bill_smith",
|
||||
"bill.smith13",
|
||||
"áki",
|
||||
"åki.smith",
|
||||
"åki.smith13",
|
||||
"åki_smith",
|
||||
];
|
||||
|
||||
usernames.forEach(username => {
|
||||
expect(USERNAME_REGEX.test(username)).toEqual(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,6 +1,6 @@
|
||||
import url from "url-regex";
|
||||
|
||||
export const USERNAME_REGEX = new RegExp(/^[a-zA-Z0-9_.]+$/);
|
||||
export const USERNAME_REGEX = new RegExp(/^[a-zA-ZÀ-ÖØ-öø-ÿ0-9_.]+$/);
|
||||
export const USERNAME_MAX_LENGTH = 30;
|
||||
export const USERNAME_MIN_LENGTH = 3;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user