Skip to content

Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.

fix assign

Uku Tahtd5e79a208349
diff --git a/lib/plausible_web/controllers/auth_controller.ex b/lib/plausible_web/controllers/auth_controller.ex
index de2b5d57b4..56e7c1e978 100644
--- a/lib/plausible_web/controllers/auth_controller.ex
+++ b/lib/plausible_web/controllers/auth_controller.ex
@@ -156,12 +156,16 @@ defmodule PlausibleWeb.AuthController do
def activate(conn, %{"code" => code}) do
user = conn.assigns[:current_user]
- invitation = Repo.get_by(Plausible.Auth.Invitation, email: user.email)
+ has_invitation =
+ Repo.exists?(
+ from i in Plausible.Auth.Invitation,
+ where: i.email == ^user.email
+ )
{code, ""} = Integer.parse(code)
case Auth.verify_email(user, code) do
:ok ->
- if invitation do
+ if has_invitation do
redirect(conn, to: "/sites")
else
redirect(conn, to: "/sites/new")
@@ -171,7 +175,7 @@ defmodule PlausibleWeb.AuthController do
render(conn, "activate.html",
error: "Incorrect activation code",
has_pin: true,
- invitation: invitation,
+ has_invitation: has_invitation,
layout: {PlausibleWeb.LayoutView, "focus.html"}
)
@@ -179,7 +183,7 @@ defmodule PlausibleWeb.AuthController do
render(conn, "activate.html",
error: "Code is expired, please request another one",
has_pin: false,
- invitation: invitation,
+ has_invitation: has_invitation,
layout: {PlausibleWeb.LayoutView, "focus.html"}
)
end