<commit_before>require "devise_zxcvbn/version"
require "devise"
require "zxcvbn"

module Devise
  mattr_accessor :min_password_score
  @@min_password_score = 4
end

Devise.add_module :zxcvbnable, :model => "devise_zxcvbn/model"
<commit_msg>Error checking on setting the min_password_score<commit_after>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"

{'fraction_non_alphanumeric': 0.09235668789808917, 'fraction_numerical': 0.008492569002123142, 'mean_word_length': 3.786802030456853, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1315919', 'n_tokens_mistral': 345, 'n_tokens_neox': 331, 'n_words': 82}