Created
December 22, 2016 22:09
-
-
Save javierg/e1a13bca18d4c0cfc80d6f2a2fd8e4c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule PhoenixUeberauthComeonin.PageController do | |
use PhoenixUeberauthComeonin.Web, :controller | |
plug Guardian.Plug.EnsureAuthenticated, handler: __MODULE__ | |
def index(conn, _params) do | |
render conn, "index.html" | |
end | |
def unauthenticated(conn, _params) do | |
conn | |
|> put_status(401) | |
|> put_flash(:error, "Authentication required") | |
|> redirect(to: "/sessions/new") | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment