Method: Authlogic::Session::Password::InstanceMethods#initialize

Defined in:
lib/authlogic/session/password.rb

#initialize(*args) ⇒ Object



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/authlogic/session/password.rb', line 116

def initialize(*args)
  if !self.class.configured_password_methods
    if 
      self.class.send(:attr_writer, ) if !respond_to?("#{}=")
      self.class.send(:attr_reader, ) if !respond_to?()
    end
    
    if password_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__
        private
          # The password should not be accessible publicly. This way forms using form_for don't fill the password with the
          # attempted password. To prevent this we just create this method that is private.
          def protected_#{password_field}
            @#{password_field}
          end
      end_eval
    end

    self.class.configured_password_methods = true
  end
  
  super
end