Sha256: c3feed8a048289805723257f760d9455b1b3907637f8b7ab54579a000c3e6bd6

Contents?: true

Size: 1.94 KB

Versions: 21

Compression:

Stored size: 1.94 KB

Contents

module AuthlogicConnect::Openid
  module User
    def self.included(base)
      base.class_eval do
        add_acts_as_authentic_module(AuthlogicConnect::Openid::Process, :prepend)
        add_acts_as_authentic_module(InstanceMethods, :append)
      end
    end
    
    module InstanceMethods
      
      def self.included(base)        
        base.class_eval do
          validate :validate_by_openid, :if => :authenticating_with_openid?
          
          validates_length_of_password_field_options validates_length_of_password_field_options.merge(:if => :validate_password_with_openid?)
          validates_confirmation_of_password_field_options validates_confirmation_of_password_field_options.merge(:if => :validate_password_with_openid?)
          validates_length_of_password_confirmation_field_options validates_length_of_password_confirmation_field_options.merge(:if => :validate_password_with_openid?)
          validates_length_of_login_field_options validates_length_of_login_field_options.merge(:if => :validate_password_with_openid?)
          validates_format_of_login_field_options validates_format_of_login_field_options.merge(:if => :validate_password_with_openid?)
        end
      end
      
      def attributes_to_save
        attr_list = [:id, :password, crypted_password_field, password_salt_field, :persistence_token, :perishable_token, :single_access_token, :login_count, 
          :failed_login_count, :last_request_at, :current_login_at, :last_login_at, :current_login_ip, :last_login_ip, :created_at,
          :updated_at, :lock_version]
        attrs_to_save = attributes.clone.delete_if do |k, v|
          attr_list.include?(k.to_sym)
        end
        if self.respond_to?(:password) && self.respond_to?(:password_confirmation)
          attrs_to_save.merge!(:password => password, :password_confirmation => password_confirmation)
        end
        attrs_to_save.reject!{|k, v| v.blank? || !self.respond_to?(k)}
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 7 rubygems

Version Path
robdimarco-authlogic-connect-0.0.6 lib/authlogic_connect/openid/user.rb
anideo-authlogic-connect-0.0.6 lib/authlogic_connect/openid/user.rb
jspooner-authlogic-connect-0.0.20 lib/authlogic_connect/openid/user.rb
jspooner-authlogic-connect-0.0.19 lib/authlogic_connect/openid/user.rb
foreverman-authlogic-connect-0.0.4 lib/authlogic_connect/openid/user.rb
foreverman-authlogic-connect-0.0.3 lib/authlogic_connect/openid/user.rb
foreverman-authlogic-connect-0.0.2 lib/authlogic_connect/openid/user.rb
foreverman-authlogic-connect-0.0.1 lib/authlogic_connect/openid/user.rb
foreverman-authlogic-connect-0.0.6 lib/authlogic_connect/openid/user.rb
authlogic-connect-andrewacove-0.5.7 lib/authlogic_connect/openid/user.rb
authlogic-connect-0.0.6 lib/authlogic_connect/openid/user.rb
authlogic-connect-0.0.5.1 lib/authlogic_connect/openid/user.rb
authlogic-connect-0.0.5 lib/authlogic_connect/openid/user.rb
authlogic-connect-andrewacove-0.5.6 lib/authlogic_connect/openid/user.rb
authlogic-connect-andrewacove-0.5.5 lib/authlogic_connect/openid/user.rb
authlogic-connect-andrewacove-0.5.4 lib/authlogic_connect/openid/user.rb
authlogic-connect-andrewacove-0.5.2 lib/authlogic_connect/openid/user.rb
authlogic-connect-andrewacove-0.5.0 lib/authlogic_connect/openid/user.rb
authlogic-connect-0.0.4.06 lib/authlogic_connect/openid/user.rb
authlogic-connect-x-0.0.4.05x lib/authlogic_connect/openid/user.rb