def authenticate
      if username? and password?
        user = user_model.find_for_session(username)

        if user
          if user.valid_session?
            if user.authenticate(@password)
              return user
            end
          end

          user.failed_authentication!
          user = nil
        end
      end

      nil
    end
def authenticate
      if username? and password?
        user = user_model.find_for_session(username)

        if user
          if user.valid_session?
            if user.authenticate(@password)
              return user
            end
          end

          user.failed_authentication!
          user = nil
        end
      end

      nil
    end
grab the params we want from this request
 if we can successfully authenticate, return a User instance, otherwise nil