Sha256: 8cd1f4006669e5dac8aaf162809b3340b13582052bcd2e8014ebe5f681a2baee

Contents?: true

Size: 976 Bytes

Versions: 2

Compression:

Stored size: 976 Bytes

Contents

module AuthlogicConnect::Common
  module User
    
    def self.included(base)
      base.class_eval do
        add_acts_as_authentic_module(Variables, :prepend)
        add_acts_as_authentic_module(InstanceMethods, :append)
      end
    end
    
    module InstanceMethods
      
      # core save method coordinating how to save the user
      def save(perform_validation = true, &block)
        status = true
        if authenticating_with_openid?
          status = save_with_openid(perform_validation, &block)
        elsif authenticating_with_oauth?
          status = save_with_oauth(perform_validation, &block)
        end
        if status
          result = super
          yield(result) if block_given?
          result
        end
        status
      end
      
      def validate_password_with_oauth?
        !using_openid? && super
      end
      
      def validate_password_with_openid?
        !using_oauth? && super
      end
      
    end
    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
authlogic-connect-0.0.2 lib/authlogic_connect/common/user.rb
authlogic-connect-0.0.1 lib/authlogic_connect/common/user.rb