def receive_auth(user, pass)
return send_auth(true) if !@auth || !@auth_required
return send_auth('auth data must include a user and pass') if user.nil? || pass.nil?
auth_attempt(user, peer_ip)
unless (@auth_required = !@auth.call(user, pass))
@user = user
auth_ok(user, peer_ip)
authenticated!
else
auth_fail(user, peer_ip)
if @auth_tries <= 0
msg = "max authentication attempts reached"
send_auth(msg)
@log.debug("[pry-remote-em] #{msg} (#{peer_ip}:#{peer_port})")
return close_connection_after_writing
end
@auth_tries -= 1
end
return send_auth(!@auth_required)
end