Sha256: e68222b001234fe4fd9360f6e6b7b5a7bd193f48a84c8ebacc72b53245568e07

Contents?: true

Size: 640 Bytes

Versions: 3

Compression:

Stored size: 640 Bytes

Contents

require "devise_zxcvbn/version"
require "devise"
require "zxcvbn"

module Devise

  @@min_password_score = 4

  def self.min_password_score
    @@min_password_score
  end
    
  def self.min_password_score=(score)
    if score.is_a?(Integer) && (score >= 0 && score <=4)
      if score >= 3
        @@min_password_score = score
      else
        ::Rails.logger.warn "[devise_zxcvbn] A score of less than 3 is not recommended." 
        @@min_password_score = score
      end
    else
      raise "The min_password_score must be an integer and between 0..4"
    end
  end
end

Devise.add_module :zxcvbnable, :model => "devise_zxcvbn/model"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
devise_zxcvbn-1.1.1 lib/devise_zxcvbn.rb
devise_zxcvbn-1.1.0 lib/devise_zxcvbn.rb
devise_zxcvbn-1.0.0 lib/devise_zxcvbn.rb