Created
June 2, 2016 20:55
-
-
Save uhtred/e24ab7fbc778716bc393f42660cab916 to your computer and use it in GitHub Desktop.
JS: Validation Rules Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
password: [ | |
{ | |
code: 'RANGE', | |
pattern: '^.{6,20}$', | |
flags: 'g', | |
message: 'Senha deve ter no mínimo 6 e no máximo 20 caracteres' | |
}, | |
{ | |
code: 'LETTERS_NUMBERS', | |
pattern: '(?=.*[a-zA-Z])(?=.*[0-9])', | |
flags: 'gi', | |
message: 'Sua senha deve conter pelo menos uma letra e um número' | |
}, | |
{ | |
code: 'REPEAT', | |
pattern: '(.)\1{2,}', | |
flags: 'gi', | |
message: 'Sua senha não pode conter caracteres repetidos em sequência' | |
}, | |
{ | |
code: 'NUMBERS_SEQUENCE', | |
pattern: '(012|123|234|345|456|567|678|789)', | |
flags: 'g', | |
message: 'Sua senha não pode conter caracteres sequenciais' | |
}, | |
{ | |
code: 'LETTERS_SEQUENCE', | |
pattern: '(abc|bcd|cde|def|efg|fgh|ghi|hij|ijk|jkl|klm|lmn|mno|nop|opq|pqr|qrs|rst|stu|tuv|uvw|vwx|wxy|xyz)', | |
flags: 'gi', | |
message: 'Sua senha não pode conter caracteres sequenciais' | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment