-
-
Notifications
You must be signed in to change notification settings - Fork 158
Open
Description
I have a custom context for password resetting:
config :myapp, :pow,
user: MyApp.Users.User,
users_context: MyApp.Users,
repo: MyApp.Repo,
web_module: MyAppWeb,
mailer_backend: MyApp.Mailer,
routes_backend: MyAppWeb.Pow.Routes,
extensions: [PowInvitation, PowResetPassword, PowEmailConfirmation],
controller_callbacks: Pow.Extension.Phoenix.ControllerCallbacks
And in my context:
defmodule MyApp.Users do
import Ecto.Query
alias MyApp.Repo
alias MyApp.Users.{User}
use Pow.Ecto.Context,
repo: MyApp.Repo,
user: MyApp.Users.User
def list_users(opts) do
Repo.all(from(u in User, limit: ^Keyword.fetch!(opts, :limit)))
|> Repo.preload(:organization)
end
def get_users_map(user_ids) when is_list(user_ids) do
Repo.all(from(u in User, where: u.id in ^user_ids, select: {u.id, u}))
|> Repo.preload(:organization)
end
@impl true
def get_by(clauses) do
IO.puts("------")
IO.inspect(clauses)
IO.puts("------")
Repo.get_by(User, clauses)
end
@impl true
def update(user, attrs) do
IO.puts("------")
IO.inspect(attrs)
IO.puts("------")
changes =
user
|> User.changeset(attrs)
|> then(fn changeset -> changeset.changes end)
|> Enum.into([])
IO.inspect(changes)
MyApp.Users.User
|> where(id: ^user.id)
|> Repo.alter_update_all(set: changes)
{:ok, get_user(user.id)}
end
...
end
I can see in my logs that my get_by is called when sending the reset password email:
------
[email: "test@gmail.com"]
------
however, i get this error for the update, and my log is never shown for the update
[error] ** (ArgumentError) ClickHouse does not support UPDATE statements -- use ALTER TABLE ... UPDATE instead
(ecto_ch 0.3.7) lib/ecto/adapters/clickhouse/connection.ex:246: Ecto.Adapters.ClickHouse.Connection.update/5
(ecto_ch 0.3.7) lib/ecto/adapters/clickhouse.ex:289: Ecto.Adapters.ClickHouse.update/6
(ecto 3.11.2) lib/ecto/repo/schema.ex:775: Ecto.Repo.Schema.apply/4
(ecto 3.11.2) lib/ecto/repo/schema.ex:467: anonymous fn/15 in Ecto.Repo.Schema.do_update/4
(pow 1.0.38) lib/extensions/reset_password/plug.ex:150: PowResetPassword.Plug.update_user_password/2
(pow 1.0.38) lib/pow/phoenix/controllers/controller.ex:87: Pow.Phoenix.Controller.action/3
(pow 1.0.38) lib/extensions/reset_password/phoenix/controllers/reset_password_controller.ex:1: PowResetPassword.Phoenix.ResetPasswordController.action/2
(pow 1.0.38) lib/extensions/reset_password/phoenix/controllers/reset_password_controller.ex:1: PowResetPassword.Phoenix.ResetPasswordController.phoenix_controller_pipeline/2
(phoenix 1.7.12) lib/phoenix/router.ex:484: Phoenix.Router.__call__/5
(myapp 0.1.0) lib/myapp_web/endpoint.ex:1: MyAppWeb.Endpoint.plug_builder_call/2
(myapp 0.1.0) deps/plug/lib/plug/debugger.ex:136: MyAppWeb.Endpoint."call (overridable 3)"/2
(myapp 0.1.0) lib/myapp_web/endpoint.ex:1: MyAppWeb.Endpoint.call/2
(phoenix 1.7.12) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4
(bandit 1.5.2) lib/bandit/pipeline.ex:124: Bandit.Pipeline.call_plug!/2
(bandit 1.5.2) lib/bandit/pipeline.ex:36: Bandit.Pipeline.run/4
(bandit 1.5.2) lib/bandit/http1/handler.ex:12: Bandit.HTTP1.Handler.handle_data/3
(bandit 1.5.2) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3
(bandit 1.5.2) /Users/jea/Documents/Code/github.nosync/myapp/app/myapp/deps/thousand_island/lib/thousand_island/handler.ex:379: Bandit.DelegatingHandler.handle_info/2
(stdlib 5.0.1) gen_server.erl:1077: :gen_server.try_handle_info/3
(stdlib 5.0.1) gen_server.erl:1165: :gen_server.handle_msg/6
It seems like my context is never called, but I'm not entirely sure why...
Metadata
Metadata
Assignees
Labels
No labels