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:
parent
3961422f85
commit
0e2aebd036
4 changed files with 39 additions and 39 deletions
|
|
@ -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} ->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue