changed status, added restoring samples and changed password guidelines
This commit is contained in:
@ -14,7 +14,7 @@ export class ValidationService {
|
||||
.max(128);
|
||||
|
||||
private vPassword = Joi.string()
|
||||
.pattern(/^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!"#%&'()*+,-.\/:;<=>?@[\]^_`{|}~])(?=\S+$)[a-zA-Z0-9!"#%&'()*+,\-.\/:;<=>?@[\]^_`{|}~]{8,}$/)
|
||||
.min(8)
|
||||
.max(128);
|
||||
|
||||
constructor() { }
|
||||
@ -44,24 +44,7 @@ export class ValidationService {
|
||||
password(data) {
|
||||
const {ignore, error} = this.vPassword.validate(data);
|
||||
if (error) {
|
||||
if (Joi.string().min(8).validate(data).error) {
|
||||
return {ok: false, error: 'password must have at least 8 characters'};
|
||||
}
|
||||
else if (Joi.string().pattern(/[a-z]+/).validate(data).error) {
|
||||
return {ok: false, error: 'password must have at least one lowercase character'};
|
||||
}
|
||||
else if (Joi.string().pattern(/[A-Z]+/).validate(data).error) {
|
||||
return {ok: false, error: 'password must have at least one uppercase character'};
|
||||
}
|
||||
else if (Joi.string().pattern(/[0-9]+/).validate(data).error) {
|
||||
return {ok: false, error: 'password must have at least one number'};
|
||||
}
|
||||
else if (Joi.string().pattern(/[!"#%&'()*+,-.\/:;<=>?@[\]^_`{|}~]+/).validate(data).error) {
|
||||
return {ok: false, error: 'password must have at least one of the following characters !"#%&\'()*+,-.\\/:;<=>?@[]^_`{|}~'};
|
||||
}
|
||||
else {
|
||||
return {ok: false, error: 'password must only contain a-zA-Z0-9!"#%&\'()*+,-./:;<=>?@[]^_`{|}~'};
|
||||
}
|
||||
return {ok: false, error: 'password must have at least 8 characters'};
|
||||
}
|
||||
return {ok: true, error: ''};
|
||||
}
|
||||
|
Reference in New Issue
Block a user