vendor/plugins/authlogic/lib/authlogic/session/base.rb
# The goal with Authlogic is to feel as natural as possible. As a result, this method creates methods on the fly
# based on the configuration set. By default the configuration is based off of the columns names in the authenticating
# model. Thus allowing you to call user_session.username instead of user_session.login if you have a username column
# instead of a login column. Since class configuration can change during initialization it makes the most sense to enforce
# this configuration during the first initialization. At this point, all configuration should be set.
#
# Lastly, each method is defined individually to allow the user to provide their own "custom" method and this makes sure
# we don't replace their method.
The goal with Authlogic is to feel as natural as possible. As a result, this method creates methods on the fly
based on the configuration set. By default the configuration is based off of the columns names in the authenticating
model. Thus allowing you to call user_session.username instead of user_session.login if you have a username column
instead of a login column. Since class configuration can change during initialization it makes the most sense to enforce
this configuration during the first initialization. At this point, all configuration should be set.

Lastly, each method is defined individually to allow the user to provide their own "custom" method and this makes sure
we don't replace their method.
The goal with Authlogic is to feel as natural as possible . As a result this method creates methods on the fly based on the configuration set . By default the configuration is based off of the columns names in the authenticating model . Thus allowing you to call user_session . username instead of user_session . login if you have a username column instead of a login column . Since class configuration can change during initialization it makes the most sense to enforce this configuration during the first initialization . At this point all configuration should be set . Lastly each method is defined individually to allow the user to provide their own " custom " method and this makes sure we don ' t replace their method .
def create_configurable_methods!
          return if self.class.methods_configured == true
          self.class.send(:alias_method, klass_name.demodulize.underscore.to_sym, :record)
          self.class.send(:attr_writer, login_field) if !respond_to?("#{login_field}=")
          self.class.send(:attr_reader, login_field) if !respond_to?(login_field)
          self.class.send(:attr_writer, password_field) if !respond_to?("#{password_field}=")
          self.class.send(:define_method, password_field) {} if !respond_to?(password_field)
          self.class.class_eval <<-"end_eval", __FILE__, __LINE__
            def #{login_field}_with_authentication_flag=(value)
              self.authenticating_with = :password
              self.#{login_field}_without_authentication_flag = value
            end
            alias_method_chain :#{login_field}=, :authentication_flag
            def #{password_field}_with_authentication_flag=(value)
              self.authenticating_with = :password
              self.#{password_field}_without_authentication_flag = value
            end
            alias_method_chain :#{password_field}=, :authentication_flag
            private
              # The password should not be accessible publicly. This way forms using form_for don't fill the password with the attempted password. The prevent this we just create this method that is private.
              def protected_#{password_field}
                @#{password_field}
              end
          end_eval
          self.class.methods_configured = true
        end
def create_configurable_methods! return if self . class . methods_configured == true self . class . send ( :alias_method , klass_name . demodulize . underscore . to_sym , :record ) self . class . send ( :attr_writer , login_field ) if ! respond_to? ( "#{login_field}=" ) self . class . send ( :attr_reader , login_field ) if ! respond_to? ( login_field ) self . class . send ( :attr_writer , password_field ) if ! respond_to? ( "#{password_field}=" ) self . class . send ( :define_method , password_field ) { } if ! respond_to? ( password_field ) self . class . class_eval <<-"end_eval" , __FILE__ , __LINE__ 
            def  #{ login_field } _with_authentication_flag=(value)
              self.authenticating_with = :password
              self. #{ login_field } _without_authentication_flag = value
            end
            alias_method_chain : #{ login_field } =, :authentication_flag
            
            def  #{ password_field } _with_authentication_flag=(value)
              self.authenticating_with = :password
              self. #{ password_field } _without_authentication_flag = value
            end
            alias_method_chain : #{ password_field } =, :authentication_flag
            
            private
              # The password should not be accessible publicly. This way forms using form_for don't fill the password with the attempted password. The prevent this we just create this method that is private.
              def protected_ #{ password_field } 
                @ #{ password_field } 
              end
           end_eval self . class . methods_configured = true end
The goal with Authlogic is to feel as natural as possible.
The goal with Authlogic is to feel as natural as possible .