Skip to content

Commit

Permalink
Include default pow controller routes and messsages in extension cont…
Browse files Browse the repository at this point in the history
…rollers
  • Loading branch information
danschultzer committed Mar 15, 2019
1 parent 1a12d97 commit a283fd2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Pow.Extension.Phoenix.ControllerCallbacks.Base do
end
end
"""
alias Pow.{Config, Extension.Phoenix.Controller.Base}
alias Pow.{Config, Extension.Phoenix.Controller.Base, Phoenix.Controller}

@callback before_process(atom(), atom(), any(), Config.t()) :: any()
@callback before_respond(atom(), atom(), any(), Config.t()) :: any()
Expand All @@ -23,9 +23,11 @@ defmodule Pow.Extension.Phoenix.ControllerCallbacks.Base do
quote do
@behaviour unquote(__MODULE__)

import Base, only: [__define_helper_methods__: 1]
require Base
require Controller

__define_helper_methods__(unquote(config))
Base.__define_helper_methods__(unquote(config))
Controller.__define_helper_methods__()

@before_compile unquote(__MODULE__)
end
Expand Down
7 changes: 7 additions & 0 deletions lib/pow/phoenix/controllers/controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ defmodule Pow.Phoenix.Controller do

defp pow_layout(conn, _config), do: ViewHelpers.layout(conn)

unquote(__MODULE__).__define_helper_methods__()
end
end

@doc false
defmacro __define_helper_methods__() do
quote do
@doc """
See `Pow.Phoenix.Controller.messages/2` for more.
Expand Down

0 comments on commit a283fd2

Please sign in to comment.