From ed1ce20c5a51ac79070d521efb6d0c6314edf5fd Mon Sep 17 00:00:00 2001 From: sadposter Date: Sat, 20 Jul 2019 14:28:25 +0100 Subject: [PATCH] add email util tasks --- lib/mix/tasks/pleroma/user.ex | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/lib/mix/tasks/pleroma/user.ex b/lib/mix/tasks/pleroma/user.ex index 8a78b4fe6..44ddd4b8d 100644 --- a/lib/mix/tasks/pleroma/user.ex +++ b/lib/mix/tasks/pleroma/user.ex @@ -395,6 +395,28 @@ def run(["delete_activities", nickname]) do end end + def run(["change_email", nickname, email]) do + start_pleroma() + with %User{} = user <- User.get_cached_by_nickname(nickname) do + user + |> User.update_changeset(%{"email" => email}) + |> User.update_and_set_cache() + shell_info("#{nickname}'s email updated") + end + end + + def run(["send_confirmation", nickname]) do + start_pleroma() + with %User{} = user <- User.get_cached_by_nickname(nickname) do + user + |> Pleroma.Emails.UserEmail.account_confirmation_email() + |> IO.inspect + |> Pleroma.Emails.Mailer.deliver!() + shell_info("#{nickname}'s email sent") + end + end + + def run(["toggle_confirmed", nickname]) do start_pleroma()