Enforce minimum password length with Abide in Foundation
Setup the following jQuery call in your application javascript file
$(function(){
$(document).foundation({
abide: {
patterns: {
password: /^(.){8,}$/
}
}
});
});
You can now use the pattern type of "password" to ensure that the entered value is at least 8 characters in length.
Ruby ERB
<%= f.password_field :password, autocomplete: "off", :required => true, :pattern => :password %>
Ruby HAML
= f.password_field :password, autocomplete: "off", :required => true, :pattern => :password
HTML5
<input autocomplete="off" id="member_password" name="member[password]" pattern="password" required="required" type="password" />
Written by Jason Yost
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Regex
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#