Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
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) # try to authenticate against the LDAP server ldap = Net::LDAP.new ldap.host = LDAP_HOST # first create the username/password strings to send to the LDAP server # in our case we need to add the domain so it looks like COMPANY\firstname.lastname ldap.auth "#{LDAP_DOMAIN}\\" + self.login, password_plaintext ldap.bind # will return false if authentication is NOT successful 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
This paste will be private.
From the Design Piracy series on my blog: