From 9712823fe6c63c49fbcb8cafca874c472ae8e11d Mon Sep 17 00:00:00 2001 From: Dan Barber Date: Fri, 2 Feb 2018 10:58:42 -0500 Subject: [PATCH] Make error handler a controller --- lib/chess/auth/error_handler.ex | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/chess/auth/error_handler.ex b/lib/chess/auth/error_handler.ex index eb4ccde..c68584f 100644 --- a/lib/chess/auth/error_handler.ex +++ b/lib/chess/auth/error_handler.ex @@ -1,12 +1,14 @@ defmodule Chess.Auth.ErrorHandler do @moduledoc false + use ChessWeb, :controller + import Plug.Conn def auth_error(conn, {_type, _reason}, _opts) do conn - |> Phoenix.Controller.put_flash(:info, "You must be logged in") - |> Phoenix.Controller.redirect(to: "/") + |> put_flash(:info, "You must be logged in") + |> redirect(to: "/") |> halt() end end