class UserSession < Authlogic::Session::Base
verify_password_method :valid_ldap_credentials?
end
class User < ActiveRecord::Base
acts_as_authentic :validate_password_field => false
protected
def valid_ldap_credentials?(password_plaintext)
ldap = Net::LDAP.new
ldap.host = LDAP_HOST
ldap.auth "#{LDAP_DOMAIN}\\" + self.login, password_plaintext
ldap.bind
end
end
class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.string :login
t.string :persistence_token
t.integer :login_count
t.datetime :last_request_at
t.datetime :last_login_at
t.datetime :current_login_at
t.string :last_login_ip
t.string :current_login_ip
t.timestamps
end
end
def self.down
drop_table :users
end
end