nrxzna
Last Updated: February 25, 2016
·
1.561K
· jasonyost
2182167268 72

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" />
Say Thanks
Respond