Created
April 17, 2014 22:48
-
-
Save edymerchk/11015803 to your computer and use it in GitHub Desktop.
password_complexity
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
| validate :password_complexity | |
| def password_complexity | |
| if password.present? and not password.match(/(?=.*\d)(?=.*[a-z])(?=.*[A-Z])/) | |
| errors.add :password, "debe incluir almenos una letra mayuscula, una miniscula y un numero" | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment