Skip to content

Commit

Permalink
Remove remaining references to login_dest
Browse files Browse the repository at this point in the history
  • Loading branch information
ukutaht committed Dec 17, 2024
1 parent 3dfaec8 commit d43896c
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 26 deletions.
2 changes: 1 addition & 1 deletion test/plausible_web/controllers/auth_controller_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -879,7 +879,7 @@ defmodule PlausibleWeb.AuthControllerTest do
assert conn.resp_cookies["remember_2fa"].max_age == 0
end

test "redirects to login_dest when set", %{conn: conn} do
test "redirects to return_to when set", %{conn: conn} do
user = insert(:user)

# enable 2FA
Expand Down
2 changes: 0 additions & 2 deletions test/plausible_web/plugs/user_session_touch_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ defmodule PlausibleWeb.Plugs.UserSessionTouchTest do
conn =
build_conn()
|> init_session()
|> put_session(:login_dest, "/")
|> UserSessionTouch.call([])

refute conn.halted
assert get_session(conn, :login_dest) == "/"
refute get_session(conn, :user_token)
end
end
23 changes: 0 additions & 23 deletions test/plausible_web/user_auth_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,6 @@ defmodule PlausibleWeb.UserAuthTest do
assert conn.private[:plug_session_info] == :renew
assert conn.resp_cookies["logged_in"].max_age > 0
assert get_session(conn, :user_token) == session.token
assert get_session(conn, :login_dest) == nil
end

test "redirects to `login_dest` if present", %{conn: conn, user: user} do
conn =
conn
|> init_session()
|> put_session("login_dest", "/next")
|> UserAuth.log_in_user(user)

assert redirected_to(conn, 302) == "/next"
end

test "redirects to `redirect_path` if present", %{conn: conn, user: user} do
Expand All @@ -51,16 +40,6 @@ defmodule PlausibleWeb.UserAuthTest do

assert redirected_to(conn, 302) == "/next"
end

test "redirect_path` has precednce over `login_dest`", %{conn: conn, user: user} do
conn =
conn
|> init_session()
|> put_session("login_dest", "/ignored")
|> UserAuth.log_in_user(user, "/next")

assert redirected_to(conn, 302) == "/next"
end
end

describe "log_out_user/1" do
Expand All @@ -76,15 +55,13 @@ defmodule PlausibleWeb.UserAuthTest do
conn =
conn
|> init_session()
|> put_session("login_dest", "/ignored")
|> UserAuth.log_out_user()

# the other session remains intact
assert %{sessions: [another_session]} = Repo.preload(user, :sessions)
assert another_session.token == another_session_token
assert conn.private[:plug_session_info] == :renew
assert conn.resp_cookies["logged_in"].max_age == 0
assert get_session(conn, :login_dest) == nil
end
end

Expand Down

0 comments on commit d43896c

Please sign in to comment.