Remove time limit

This commit is contained in:
Liam 2024-07-19 18:24:06 -04:00
parent 7e92d5a734
commit 335fc0bc56

View file

@ -15,7 +15,6 @@ defmodule PhilomenaWeb.Admin.User.EraseController do
plug :prevent_deleting_privileged_users plug :prevent_deleting_privileged_users
plug :prevent_deleting_verified_users plug :prevent_deleting_verified_users
plug :prevent_deleting_old_users
def new(conn, _params) do def new(conn, _params) do
render(conn, "new.html", title: "Erase user") render(conn, "new.html", title: "Erase user")
@ -57,18 +56,4 @@ defmodule PhilomenaWeb.Admin.User.EraseController do
conn conn
end end
end end
defp prevent_deleting_old_users(conn, _opts) do
now = DateTime.utc_now(:second)
two_weeks = 1_209_600
if DateTime.compare(now, DateTime.add(conn.assigns.user.created_at, two_weeks)) == :gt do
conn
|> put_flash(:error, "Cannot erase a user older than two weeks")
|> redirect(to: ~p"/profiles/#{conn.assigns.user}")
|> Plug.Conn.halt()
else
conn
end
end
end end