Skip to content

Commit

Permalink
Check for Phoenix.View when setting up controller
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultzer committed Aug 30, 2023
1 parent c76f3d6 commit 9e84cab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## v1.0.32 (TBA)

## Bug fixes

- [`Pow.Phoenix.Controller`] Now uses `Phoenix.View` when it's available with `:namespace` option to prevent upgrade issues

## v1.0.31 (2023-06-09)

## Bug fixes
Expand Down
10 changes: 4 additions & 6 deletions lib/pow/phoenix/controllers/controller.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,14 @@ defmodule Pow.Phoenix.Controller do
defmacro __using__(config) do
quote do
use Phoenix.Controller, (
# Credo will complain about unless statement but we want this first
# credo:disable-for-next-line
unless Pow.dependency_vsn_match?(:phoenix, "< 1.7.0") do
# TODO: Remove when Phoenix 1.7 is required
if Code.ensure_loaded?(Phoenix.View) do
[namespace: Pow.Phoenix]
else
[
layouts: [html: Pow.Phoenix.Layouts],
formats: [:html]
]
else
# TODO: Remove when Phoenix 1.7 is required
[namespace: Pow.Phoenix]
end)

import unquote(__MODULE__), only: [require_authenticated: 2, require_not_authenticated: 2, put_no_cache_header: 2]
Expand Down

0 comments on commit 9e84cab

Please sign in to comment.