I am using pow package for auth. I am trying to logged in user after confirms email instead of redirecting login page.
This is controller callback method
def before_respond(PowEmailConfirmation.Phoenix.ConfirmationController, :show, {:ok, user, conn}, _config) do
conn =
PowPersistentSession.Plug.create(conn, user)
|> redirect(to: Routes.page_path(conn, :index))
|> halt()
{:ok, user, conn}
end
Everything works fine but i am getting this error
** (exit) an exception was raised:
** (Plug.Conn.AlreadySentError) the response was already sent
(plug 1.16.1) lib/plug/conn.ex:881: Plug.Conn.put_resp_header/3
(phoenix 1.7.14) lib/phoenix/controller.ex:495: Phoenix.Controller.redirect/2
(pow 1.0.28) lib/extensions/email_confirmation/phoenix/controllers/confirmation_controller.ex:1: PowEmailConfirmation.Phoenix.ConfirmationController.action/2
(pow 1.0.28) lib/extensions/email_confirmation/phoenix/controllers/confirmation_controller.ex:1: PowEmailConfirmation.Phoenix.ConfirmationController.phoenix_controller_pipeline/2
(phoenix 1.7.14) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
(my_app 0.0.1) deps/plug/lib/plug/error_handler.ex:80: MyAppWeb.Router.call/2
(my_app 0.0.1) lib/my_app_web/endpoint.ex:1: MyAppWeb.Endpoint.plug_builder_call/2
(my_app 0.0.1) lib/my_app_web/endpoint.ex:1: MyAppWeb.Endpoint."call (overridable 3)"/2
how can I fix this issue?