Files

Devise::Models::Unix2ChkpwdAuthenticatable::ClassMethods

Public Instance Methods

authenticate_with_unix2_chkpwd(attributes={}) click to toggle source
# File lib/devise_unix2_chkpwd_authenticatable/model.rb, line 60
 def authenticate_with_unix2_chkpwd(attributes={})
  Rails.logger.debug "*** Authenticate with UNIX2_CHKPWD, username: #{attributes[:username].inspect}"
  return nil unless attributes[:username].present?

  resource = scoped.where(:username => attributes[:username]).first

  if resource.blank?
    resource = new
    resource[:username] = attributes[:username]
    resource[:password] = attributes[:password]
  end

  if resource.try(:unix2_chkpwd, attributes[:username], attributes[:password])
    resource.save if resource.new_record?
    return resource
  else
    return nil
  end
  
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.