put_layout is the right way to deal with custom templates for certain roles, but I think what you are asking for is how to redirect the user after sign in depending on the role.
You can customize the callback routes to redirect admin users: Pow — Pow v1.0.13
So you can do something like:
defmodule MyAppWeb.Pow.Routes do
use Pow.Phoenix.Routes
alias MyAppWeb.Router.Helpers, as: Routes
def after_sign_in_path(conn) do
user = Pow.Plug.current_user(conn)
case user.role do
"admin" -> Routes.admin_dashboard_path(conn, :index)
_any -> Routes.game_path(conn, :index)
end
end
This will redirect admin users to the admin dashboard instead of the game page. Remember to add routes_backend: MyAppWeb.Pow.Routes to the config.






















