Last active
May 14, 2018 09:49
-
-
Save mezbahalam/3fb8237274552025de6705196c8a1f99 to your computer and use it in GitHub Desktop.
rails strong password validator regex
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
validates :password, | |
length: { minimum: 10 }, | |
format: { with: /\A(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[\W]).{10,}\z/, | |
message: "Must contain at least one uppercase letter, one special character, one number and one lowercase letter" } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment