feat: expanded allowed characters in usernames to support accents (#2585)

This commit is contained in:
Wyatt Johnson
2019-09-23 14:55:38 -04:00
committed by Kim Gardner
parent b3064c89de
commit 6fb772944c
2 changed files with 21 additions and 1 deletions
+20
View File
@@ -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 -1
View File
@@ -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;