Fix username/mention regexes

* Allow underscore instead of hypen
* Fix domain part handling
* Add tests for remote mention
This commit is contained in:
unarist
2018-04-09 01:10:04 +09:00
parent 34281de04e
commit 3c4235067f
6 changed files with 17 additions and 7 deletions

View File

@@ -89,7 +89,7 @@ export const isRemoteUser = (user: any): user is IRemoteUser =>
//#region Validators
export function validateUsername(username: string): boolean {
return typeof username == 'string' && /^[a-zA-Z0-9\-]{3,20}$/.test(username);
return typeof username == 'string' && /^[a-zA-Z0-9_]{3,20}$/.test(username);
}
export function validatePassword(password: string): boolean {