TwitterAPI: Make change_email require body params instead of query

Backport of: https://git.pleroma.social/pleroma/pleroma/-/merge_requests/3503
This commit is contained in:
Haelwenn (lanodan) Monnier 2021-08-10 20:33:00 +02:00
commit 0e2aebd036
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
4 changed files with 39 additions and 39 deletions

View file

@ -104,10 +104,10 @@ defmodule Pleroma.Web.TwitterAPI.UtilController do
end
end
def change_email(%{assigns: %{user: user}} = conn, %{password: password, email: email}) do
case CommonAPI.Utils.confirm_current_password(user, password) do
def change_email(%{assigns: %{user: user}, body_params: body_params} = conn, %{}) do
case CommonAPI.Utils.confirm_current_password(user, body_params.password) do
{:ok, user} ->
with {:ok, _user} <- User.change_email(user, email) do
with {:ok, _user} <- User.change_email(user, body_params.email) do
json(conn, %{status: "success"})
else
{:error, changeset} ->