Puppet Function: validate_password
- Defined in:
- lib/puppet/parser/functions/validate_password.rb
- Function type:
- Ruby 3.x API
Overview
validate a given password with complexity requirements
8 9 10 11 12 13 14 15 16 |
# File 'lib/puppet/parser/functions/validate_password.rb', line 8 newfunction(:validate_password, :type => :rvalue, :doc => <<-EOS validate a given password with complexity requirements EOS ) do |args| raise(Puppet::ParseError, "validate_password(): Wrong number of arguments " + "given (#{args.size} for 1)") if args.size != 1 reg = /^(?=.*\d)(?=.*([a-z]|[A-Z]))([\x20-\x7E]){8,}$/ return (reg.match(args[0]))? true : false end |