You can exclude PowInvitation in the Pow.Extension.Phoenix.Router macro opts and add in the routes manually:
defmodule MyAppWeb.Router do
use MyAppWeb, :router
use Pow.Phoenix.Router
use Pow.Extension.Phoenix.Router,
extensions: [PowResetPassword, PowEmailConfirmation]
# ...
scope "/", PowInvitation.Phoenix, as: "pow_invitation" do
pipe_through [:browser]
resources "/invitations", InvitationController, only: [:edit, :update]
end
scope "/" do
pipe_through :browser
pow_routes()
pow_extension_routes()
end
# ...
end
To create the invited user:
PowInvitation.Ecto.Context.create(invited_by, params, config)
To send out the invitation email you need this:
defp deliver_email(conn, user, invited_by) do
url = Routes.pow_invitation_path(conn, :edit, [user.invitation_token]]
email = PowInvitation.Phoenix.Mailer.invitation(conn, user, invited_by, url)
Pow.Phoenix.Mailer.deliver(conn, email)
end
PowInvitation expects an invited_by assoc which is the user that initiated the invitation. You can make a custom invite_changeset/3 to ignore it.






















