Module: PasswordReusePolicy::Mongo::ClassMethods

Defined in:
lib/password_reuse_policy/mongo.rb

Instance Method Summary collapse

Instance Method Details

#register!Object



3
4
5
6
7
8
9
# File 'lib/password_reuse_policy/mongo.rb', line 3

def register!
  raise NoMongoid::DocumentError, "Mongoid::Document is not defiend" unless defined? Mongoid::Document
  raise NoMongoid::DocumentError, "Mongoid::Document is not inlcuded in the class" unless self.include? Mongoid::Document

  field :last_used_passwords, type: Hash, default: {}
  before_save :set_last_used_passwords,  :if => :password_present?
end