aboutsummaryrefslogtreecommitdiff
path: root/lib/pleroma/web/twitter_api/controllers/util_controller.ex
diff options
context:
space:
mode:
authorEgor Kislitsyn <egor@kislitsyn.com>2019-03-04 19:55:11 +0700
committerEgor Kislitsyn <egor@kislitsyn.com>2019-03-04 19:55:11 +0700
commiteb84de01439c4ee25f59390e5be4ffa7f36e01b8 (patch)
tree63c935841bf4063278baff298e00724a2db46794 /lib/pleroma/web/twitter_api/controllers/util_controller.ex
parentdd5865535eb16f535ff996eb3dec5e947a905268 (diff)
downloadpleroma-eb84de01439c4ee25f59390e5be4ffa7f36e01b8.tar.gz
allow users to disable their own account
Diffstat (limited to 'lib/pleroma/web/twitter_api/controllers/util_controller.ex')
-rw-r--r--lib/pleroma/web/twitter_api/controllers/util_controller.ex11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/pleroma/web/twitter_api/controllers/util_controller.ex b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
index e2fdedb25..0006d53e8 100644
--- a/lib/pleroma/web/twitter_api/controllers/util_controller.ex
+++ b/lib/pleroma/web/twitter_api/controllers/util_controller.ex
@@ -311,6 +311,17 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
end
end
+ def disable_account(%{assigns: %{user: user}} = conn, params) do
+ case CommonAPI.Utils.confirm_current_password(user, params["password"]) do
+ {:ok, user} ->
+ User.disable_async(user)
+ json(conn, %{status: "success"})
+
+ {:error, msg} ->
+ json(conn, %{error: msg})
+ end
+ end
+
def captcha(conn, _params) do
json(conn, Pleroma.Captcha.new())
end