add email util tasks
authorsadposter <hannah+pleroma@coffee-and-dreams.uk>
Sat, 20 Jul 2019 13:28:25 +0000 (14:28 +0100)
committersadposter <hannah+pleroma@coffee-and-dreams.uk>
Sat, 20 Jul 2019 13:28:25 +0000 (14:28 +0100)
lib/mix/tasks/pleroma/user.ex

index 8a78b4fe663b7a8e792f773716f9b2fb6b4a6caa..44ddd4b8d81d7d931816a7e83f25b09aef2ec642 100644 (file)
@@ -395,6 +395,28 @@ defmodule Mix.Tasks.Pleroma.User 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()