This generates a Context file where every function raises “TODO”. It’s better than nothing at all generated, but certainly not as good as the default experience with Phoenix generators.
A more typical use case would probably involve some fields on the user, so it would probably make sense to have an example of a mix phx.gen.html
(or api) where there’s at least one field on the user to see how it interacts with Pow. (I’ll write one such example myself once I understand how everything works and figure out a nice flow!)
This was useful in getting a handle with which to inspect the incoming data. However, adding it also causes my (new Phoenix) app to crash entirely on Github auth because PowAssent.RegistrationView
isn’t available.
Here’s my entire User.ex:
defmodule MyApp.Users.User do
use Ecto.Schema
use Pow.Ecto.Schema
use PowAssent.Ecto.Schema
schema "users" do
pow_user_fields()
timestamps()
end
def user_identity_changeset(user_or_changeset, user_identity, attrs, user_id_attrs) do
user_or_changeset
|> Ecto.Changeset.cast(attrs, [])
|> pow_assent_user_identity_changeset(user_identity, attrs, user_id_attrs)
end
end
I saw your comments on this thread so I tried making some changes in my router but with no success thus far. Other than the addition of the one protected route, “/secret”, it’s just a fresh install plus what the PowAssent “getting started” section advised. Here’s the relevant portion of it:
scope "/" do
pipe_through :skip_csrf_protection
pow_assent_authorization_post_callback_routes()
end
scope "/" do
pipe_through [:browser]
pow_routes()
pow_assent_routes()
end
scope "/", MyAppWeb do
pipe_through [:browser]
scope "secret" do
pipe_through [:protected]
get "/", PageController, :secret
end
get "/", PageController, :index
end