Module: Devise::W3Adapter

Defined in:
lib/devise_w3_authenticatable/w3_adapter.rb

Defined Under Namespace

Classes: IBMEmployee

Class Method Summary collapse

Class Method Details

.valid_credentials?(logon, password) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
# File 'lib/devise_w3_authenticatable/w3_adapter.rb', line 7

def self.valid_credentials?(logon, password)
  return unless employee = IBMEmployee.find_by_mail(logon)

  user = Net::LDAP.new :host => "bluepages.ibm.com"
  user.authenticate(employee.uid, password)

  user.bind and employee
end