helpers do

  def current_user
    User.find_by(id: session[:user_id])
  end

  def logout_user
    sessions[:user_id] = nil
  end

  def existing_user?
    if User.find_by(email: current_user[:email])
      true
    else
      false
    end
  end

end

helpers do

  def current_user
    User.find_by(id: session[:user_id]) if session[:user_id]
  end

  def logout_user
    sessions[:user_id] = nil
  end

  def existing_user?
    if User.find_by(email: current_user[:email])
      true
    else
      false
    end
  end

end

Secure by checking for cookie
Secure by checking for cookie