Show better error message on duplicate domain

Co-authored-by: Marko Saric <me@markosaric.com>
This commit is contained in:
Uku Taht 2022-03-10 15:11:19 -06:00
parent e27734ed79
commit e026148fb0
2 changed files with 6 additions and 2 deletions

View File

@ -43,7 +43,10 @@ defmodule Plausible.Site do
|> validate_format(:domain, ~r/^[a-zA-Z0-9\-\.\/\:]*$/,
message: "only letters, numbers, slashes and period allowed"
)
|> unique_constraint(:domain)
|> unique_constraint(:domain,
message:
"This domain has already been taken. Perhaps one of your team members registered it? If that's not the case, please contact support@plausible.io"
)
|> clean_domain
end

View File

@ -259,7 +259,8 @@ defmodule PlausibleWeb.SiteControllerTest do
}
})
assert html_response(conn, 200) =~ "has already been taken"
assert html_response(conn, 200) =~
"This domain has already been taken. Perhaps one of your team members registered it? If that&#39;s not the case, please contact support@plausible.io"
end
end