From fd6177af5f597fc2738c2b4ffca6b1bd3741ddca Mon Sep 17 00:00:00 2001 From: Adrian Gruntkowski Date: Mon, 27 Nov 2023 17:38:19 +0100 Subject: [PATCH] Delete trust cookie when disabling 2FA --- lib/plausible_web/controllers/auth_controller.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.ex index 4e474d13f..bfadda8b3 100644 --- a/lib/plausible_web/controllers/auth_controller.ex +++ b/lib/plausible_web/controllers/auth_controller.ex @@ -372,6 +372,7 @@ defmodule PlausibleWeb.AuthController do case Auth.TOTP.disable(conn.assigns.current_user, password) do {:ok, _} -> conn + |> delete_resp_cookie(@remember_2fa_cookie, sign: true, max_age: @remember_2fa_seconds) |> put_flash(:success, "Two-factor authentication is disabled") |> redirect(to: Routes.auth_path(conn, :user_settings) <> "#setup-2fa")