TwitterAPI: allow deleting one's own account with request body
This commit is contained in:
parent
0b2119d4a7
commit
8672ad6b00
3 changed files with 49 additions and 5 deletions
|
|
@ -123,8 +123,10 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
|
|||
end
|
||||
end
|
||||
|
||||
def delete_account(%{assigns: %{user: user}} = conn, params) do
|
||||
password = params[:password] || ""
|
||||
def delete_account(%{assigns: %{user: user}, body_params: body_params} = conn, params) do
|
||||
# This endpoint can accept a query param or JSON body for backwards-compatibility.
|
||||
# Submitting a JSON body is recommended, so passwords don't end up in server logs.
|
||||
password = body_params[:password] || params[:password] || ""
|
||||
|
||||
case CommonAPI.Utils.confirm_current_password(user, password) do
|
||||
{:ok, user} ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue