PromucFlow_constructor/app/client/src/utils/formhelpers.ts

20 lines
556 B
TypeScript
Raw Normal View History

2019-12-16 08:49:10 +00:00
const PASSWORD_MIN_LENGTH = 6;
2019-11-21 10:52:49 +00:00
2019-12-16 08:49:10 +00:00
export const hashPassword = (password: string) => {
return password;
2019-11-21 10:52:49 +00:00
};
2019-12-16 08:49:10 +00:00
export const isEmptyString = (value: string) => {
return !value || value.trim().length === 0 || typeof value !== "string";
};
export const isStrongPassword = (value: string) => {
return value.trim().length >= PASSWORD_MIN_LENGTH;
};
// TODO (abhinav): Use a regex which adheres to standards RFC5322
export const isEmail = (value: string) => {
const re = /^([A-Za-z0-9_\-.])+@([A-Za-z0-9_\-.])+.([A-Za-z]{2,5})$/;
return re.test(value);
2019-11-21 10:52:49 +00:00
};