# File lib/devise_unix2_chkpwd_authenticatable/model.rb, line 63
        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