smpallen99 / coherence

Coherence is a full featured, configurable authentication system for Phoenix
MIT License
1.27k stars 224 forks source link

undefined function unlock_path/2 #373

Open skull-squadron opened 6 years ago

skull-squadron commented 6 years ago

Similar to #323

Stacktrace

$ mix ecto.setup
Compiling 32 files (.ex)

== Compilation error in file lib/bank_of_meetup_web/views/coherence/unlock_view.ex ==
** (CompileError) lib/bank_of_meetup_web/templates/coherence/unlock/new.html.eex:3: undefined function unlock_path/2
    (stdlib) lists.erl:1338: :lists.foreach/2
    (stdlib) erl_eval.erl:677: :erl_eval.do_apply/6
    (elixir) lib/kernel/parallel_compiler.ex:206: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/6

mix.exs

  def application do
    [
      mod: {BankOfMeetup.Application, []},
      extra_applications: [:logger, :runtime_tools, :coherence]
    ]
  end

  defp deps do
    [
      {:phoenix, "~> 1.3.4"},
      {:phoenix_pubsub, "~> 1.0"},
      {:phoenix_ecto, "~> 3.2"},
      {:postgrex, ">= 0.0.0"},
      {:phoenix_html, "~> 2.10"},
      {:phoenix_live_reload, "~> 1.0", only: :dev},
      {:coherence, "~> 0.5"},
      {:gettext, "~> 0.11"},
      {:cowboy, "~> 1.0"}
    ]
  end

Generator invocation

mix coh.install --full-invitable && mix ecto.setup

Config


# %% Coherence Configuration %%   Don't remove this line
config :coherence,
  user_schema: BankOfMeetup.Coherence.User,
  repo: BankOfMeetup.Repo,
  module: BankOfMeetup,
  web_module: BankOfMeetupWeb,
  router: BankOfMeetupWeb.Router,
  messages_backend: BankOfMeetupWeb.Coherence.Messages,
  logged_out_url: "/",
  registration_permitted_attributes: ["email","name","password","current_password","password_confirmation"],
  invitation_permitted_attributes: ["name","email"],
  password_reset_permitted_attributes: ["reset_password_token","password","password_confirmation"],
  session_permitted_attributes: ["remember","email","password"],
  email_from_name: "Your Name",
  email_from_email: "yourname@example.com",
  opts: [:authenticatable, :recoverable, :lockable, :trackable, :unlockable_with_token, :invitable, :registerable]

config :coherence, BankOfMeetupWeb.Coherence.Mailer,
  adapter: Swoosh.Adapters.Sendgrid,
  api_key: "your api key here"
# %% End Coherence Configuration %%
smpallen99 commented 5 years ago

Looks like a bug

castengo commented 5 years ago

This happened to me. Did you add the coherence routes to your router before you ran mix ecto.setup? That fixed mine.

  # Add this block
  scope "/" do
    pipe_through :browser
    coherence_routes()
  end

  # Add this block
  scope "/" do
    pipe_through :protected
    coherence_routes :protected
  end