mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-17 22:47:59 +01:00
Remove time limit
This commit is contained in:
parent
7e92d5a734
commit
335fc0bc56
1 changed files with 0 additions and 15 deletions
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue