Skip to content

Commit

Permalink
fix: use href attribute in deauthorization link to correctly handle D…
Browse files Browse the repository at this point in the history
…ELETE method
  • Loading branch information
gildo committed Apr 27, 2024
1 parent 9833bc4 commit 0b03683
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/pow_assent/phoenix/html/core_components.ex
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponents do
assigns = assign(assigns, navigate: path)

~H"""
<.link navigate={@navigate} method="delete" {@rest}><%= render_slot(@inner_block) || remove_provider_authentication_label(@conn, @provider) %></.link>
<.link href={@navigate} method="delete" {@rest}><%= render_slot(@inner_block) || remove_provider_authentication_label(@conn, @provider) %></.link>
"""
end
end
Expand Down
14 changes: 7 additions & 7 deletions test/pow_assent/phoenix/html/core_components_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponentsTest do

expected = fn assigns ->
~H"""
<.link navigate={"/auth/test_provider"} method="delete">
<.link href={"/auth/test_provider"} method="delete">
Remove Test provider authentication
</.link><.link navigate={"/auth/other_provider/new"}>
Sign in with Other provider
Expand All @@ -66,7 +66,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponentsTest do

expected = fn assigns ->
~H"""
<.link navigate={"/auth/test_provider"} method="delete" class="deauth">
<.link href={"/auth/test_provider"} method="delete" class="deauth">
Remove Test provider authentication
</.link><.link navigate={"/auth/other_provider/new"} class="auth">
Sign in with Other provider
Expand All @@ -91,7 +91,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponentsTest do

expected = fn assigns ->
~H"""
<.link navigate={"/auth/test_provider"} method="delete">
<.link href={"/auth/test_provider"} method="delete">
Deauthorization
</.link><.link navigate={"/auth/other_provider/new"}>
Authorization
Expand All @@ -114,7 +114,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponentsTest do

expected = fn assigns ->
~H"""
<.link navigate={"/auth/test_provider"} method="delete">
<.link href={"/auth/test_provider"} method="delete">
Remove Test provider authentication
</.link><.link navigate={"/auth/other_provider/new?request_path=%2Fcustom-url"}>
Sign in with Other provider
Expand All @@ -137,7 +137,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponentsTest do

expected = fn assigns ->
~H"""
<.link navigate={"/auth/test_provider"} method="delete">
<.link href={"/auth/test_provider"} method="delete">
Remove Test provider authentication
</.link><.link navigate={"/auth/other_provider/new?invitation_token=token"}>
Sign in with Other provider
Expand Down Expand Up @@ -196,7 +196,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponentsTest do

expected = fn assigns ->
~H"""
<.link navigate={"/auth/my_provider"} class="example">Remove My provider authentication</.link>
<.link href={"/auth/my_provider"} method="delete" class="example">Remove My provider authentication</.link>
"""
end

Expand All @@ -215,7 +215,7 @@ defmodule PowAssent.Phoenix.HTML.CoreComponentsTest do

expected = fn assigns ->
~H"""
<.link navigate={"/auth/my_provider"}>
<.link href={"/auth/my_provider"} method="delete">
Deauthorize
</.link>
"""
Expand Down

0 comments on commit 0b03683

Please sign in to comment.