Created
December 10, 2017 23:05
-
-
Save juanpabloaj/2bd3ca80bdf1b75cf33bdc92a90a3359 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
Add :coherence to your applications list in mix.exs. | |
def application do | |
[mod: {Chatourius, []}, | |
applications: [..., :coherence]] | |
end | |
Add the following to your router.ex file. | |
defmodule Chatourius.Router do | |
use Chatourius.Web, :router | |
use Coherence.Router # Add this | |
pipeline :browser do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_flash | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers | |
plug Coherence.Authentication.Session # Add this | |
end | |
pipeline :protected do | |
plug :accepts, ["html"] | |
plug :fetch_session | |
plug :fetch_flash | |
plug :protect_from_forgery | |
plug :put_secure_browser_headers | |
plug Coherence.Authentication.Session, protected: true # Add this | |
end | |
# Add this block | |
scope "/" do | |
pipe_through :browser | |
coherence_routes() | |
end | |
# Add this block | |
scope "/" do | |
pipe_through :protected | |
coherence_routes :protected | |
end | |
scope "/", Chatourius do | |
pipe_through :browser | |
get "/", PageController, :index | |
# Add public routes below | |
end | |
scope "/", Chatourius do | |
pipe_through :protected | |
# Add protected routes below | |
end | |
end | |
You might want to add the following to your priv/repo/seeds.exs file. | |
Chatourius.Repo.delete_all Chatourius.User | |
Chatourius.User.changeset(%Chatourius.User{}, %{name: "Test User", email: "testuser@example.com", pas | |
sword: "secret", password_confirmation: "secret"}) | |
|> Chatourius.Repo.insert! | |
Don't forget to run the new migrations and seeds with: | |
$ mix ecto.setup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment