@@ -985,13 +985,19 @@ defmodule Mix.Tasks.Coh.Install do
985985 block = """
986986 You might want to add the following to your priv/repo/seeds.exs file.
987987
988- #{ repo } .delete_all #{ user_schema }
989-
990- #{ user_schema } .changeset(%#{ user_schema } {}, %{name: "Test User", email: "testuser@example.com", password: "secret", password_confirmation: "secret"})
991- |> #{ repo } .insert!
988+ #{ repo } .delete_all(#{ user_schema } )
989+
990+ %#{ user_schema } {}
991+ |> #{ user_schema } .changeset(%{
992+ name: "Test User",
993+ email: "testuser@example.com",
994+ password: "secret",
995+ password_confirmation: "secret"
996+ })
997+ |> #{ repo } .insert!()
992998 """
993999
994- confirm = if config [ :confirmable ] , do: "|> Coherence.Controller.confirm!\n " , else: ""
1000+ confirm = if config [ :confirmable ] , do: "|> Coherence.Controller.confirm!() \n " , else: ""
9951001 block <> confirm
9961002 end
9971003
@@ -1003,12 +1009,14 @@ defmodule Mix.Tasks.Coh.Install do
10031009
10041010 defmodule #{ base } .User do
10051011 use Ecto.Schema
1006- use Coherence.Schema # Add this
1012+ # Add this
1013+ use Coherence.Schema
10071014
10081015 schema "users" do
10091016 field :name, :string
10101017 field :email, :string
1011- coherence_schema() # Add this
1018+ # Add this
1019+ coherence_schema()
10121020
10131021 timestamps()
10141022 end
@@ -1018,12 +1026,16 @@ defmodule Mix.Tasks.Coh.Install do
10181026 |> cast(params, [:name, :email] ++ coherence_fields)
10191027 |> validate_required([:name, :email])
10201028 |> unique_constraint(:email)
1021- |> validate_coherence(params) # Add this
1029+ # Add this
1030+ |> validate_coherence(params)
10221031 end
10231032
10241033 def changeset(model, params, :password) do
10251034 model
1026- |> cast(params, ~w(password password_confirmation reset_password_token reset_password_sent_at))
1035+ |> cast(
1036+ params,
1037+ ~w(password password_confirmation reset_password_token reset_password_sent_at)
1038+ )
10271039 |> validate_coherence_password_reset(params)
10281040 end
10291041 end
@@ -1050,24 +1062,27 @@ defmodule Mix.Tasks.Coh.Install do
10501062
10511063 defmodule #{ router } do
10521064 use #{ web_base } , :router
1053- use Coherence.Router # Add this
1065+ # Add this
1066+ use Coherence.Router
10541067
10551068 pipeline :browser do
10561069 plug(:accepts, ["html"])
10571070 plug(:fetch_session)
10581071 plug(:fetch_flash)
10591072 plug(:protect_from_forgery)
10601073 plug(:put_secure_browser_headers)
1061- plug(Coherence.Authentication.Session) # Add this
1074+ # Add this
1075+ plug(Coherence.Authentication.Session)
10621076 end
10631077
1078+ # Add this block
10641079 pipeline :protected do
10651080 plug(:accepts, ["html"])
10661081 plug(:fetch_session)
10671082 plug(:fetch_flash)
10681083 plug(:protect_from_forgery)
10691084 plug(:put_secure_browser_headers)
1070- plug(Coherence.Authentication.Session, protected: true) # Add this
1085+ plug(Coherence.Authentication.Session, protected: true)
10711086 end
10721087
10731088 # Add this block
0 commit comments