2019-12-16 08:49:10 +00:00
|
|
|
const PASSWORD_MIN_LENGTH = 6;
|
2021-08-04 09:33:33 +00:00
|
|
|
const PASSWORD_MAX_LENGTH = 48;
|
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) => {
|
2020-10-07 06:44:44 +00:00
|
|
|
return !value || value.trim().length === 0 || false;
|
2019-12-16 08:49:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export const isStrongPassword = (value: string) => {
|
2021-08-04 09:33:33 +00:00
|
|
|
const passwordLength = value.trim().length;
|
|
|
|
|
return (
|
|
|
|
|
passwordLength >= PASSWORD_MIN_LENGTH &&
|
|
|
|
|
passwordLength < PASSWORD_MAX_LENGTH
|
|
|
|
|
);
|
2019-12-16 08:49:10 +00:00
|
|
|
};
|
|
|
|
|
|
2020-10-07 06:44:44 +00:00
|
|
|
export const noSpaces = (value: string) => {
|
|
|
|
|
return !value || value.trim().length === 0;
|
|
|
|
|
};
|
|
|
|
|
|
2019-12-16 08:49:10 +00:00
|
|
|
// TODO (abhinav): Use a regex which adheres to standards RFC5322
|
|
|
|
|
export const isEmail = (value: string) => {
|
2020-08-19 04:37:20 +00:00
|
|
|
const re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
2019-12-16 08:49:10 +00:00
|
|
|
return re.test(value);
|
2019-11-21 10:52:49 +00:00
|
|
|
};
|