Module: Merb::Authentication::Mixins::SaltedUser

Defined in:
lib/merb-auth-more/mixins/salted_user.rb,
lib/merb-auth-more/mixins/salted_user/ar_salted_user.rb,
lib/merb-auth-more/mixins/salted_user/dm_salted_user.rb,
lib/merb-auth-more/mixins/salted_user/sq_salted_user.rb,
lib/merb-auth-more/mixins/salted_user/mongoid_salted_user.rb,
lib/merb-auth-more/mixins/salted_user/relaxdb_salted_user.rb

Overview

This mixin provides basic salted user password encryption.

Added properties:

:crypted_password, String
:salt,             String

To use it simply require it and include it into your user class.

class User

include Merb::Authentication::Mixins::SaltedUser

end

Defined Under Namespace

Modules: ARClassMethods, ClassMethods, DMClassMethods, InstanceMethods, MongoidClassMethods, RDBClassMethods, SQ3Hooks, SQ3Validations, SQClassMethods, SQInstanceMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/merb-auth-more/mixins/salted_user.rb', line 21

def self.included(base)
  base.class_eval do
    attr_accessor :password, :password_confirmation

    include Merb::Authentication::Mixins::SaltedUser::InstanceMethods
    extend  Merb::Authentication::Mixins::SaltedUser::ClassMethods

    path = "merb-auth-more/mixins/salted_user"
    if defined?(DataMapper) && DataMapper::Resource > self
      require "#{path}/dm_salted_user"
      extend(Merb::Authentication::Mixins::SaltedUser::DMClassMethods)
    elsif defined?(Mongoid) && Mongoid::Document > self
      require "#{path}/mongoid_salted_user"
      extend(Merb::Authentication::Mixins::SaltedUser::MongoidClassMethods)
    elsif defined?(ActiveRecord) && ancestors.include?(ActiveRecord::Base)
      require "#{path}/ar_salted_user"
      extend(Merb::Authentication::Mixins::SaltedUser::ARClassMethods)
    elsif defined?(Sequel) && ancestors.include?(Sequel::Model)
      require "#{path}/sq_salted_user"
      extend(Merb::Authentication::Mixins::SaltedUser::SQClassMethods)
    elsif defined?(RelaxDB) && ancestors.include?(RelaxDB::Document)
      require "#{path}/relaxdb_salted_user"
      extend(Merb::Authentication::Mixins::SaltedUser::RDBClassMethods)
    end

  end # base.class_eval
end