admin 管理员组文章数量: 1086019
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?
本文标签: elixirPlugConnAlreadySentError in pow auth when trying to loggedin after email confirmStack Overflow
版权声明:本文标题:elixir - Plug.Conn.AlreadySentError in pow auth when trying to loggedin after email confirm - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.roclinux.cn/p/1744033351a2521913.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论