1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-19 05:09:43 +02:00
planka/client/src/utils/validator.js

9 lines
297 B
JavaScript
Raw Normal View History

import zxcvbn from 'zxcvbn';
2021-04-13 18:59:02 +05:00
const USERNAME_REGEX = /^[a-zA-Z0-9]+((_|\.)?[a-zA-Z0-9])*$/;
2020-04-03 00:35:25 +05:00
export const isPassword = (string) => zxcvbn(string).score >= 2; // TODO: move to config
2022-08-26 18:59:44 +02:00
export const isUsername = (string) =>
string.length >= 3 && string.length <= 16 && USERNAME_REGEX.test(string);