+++ /dev/null
-defmodule Mix.Tasks.Pleroma.Gen.Invite do
- use Mix.Task
-
- @shortdoc "Generates a user invite token"
- def run([]) do
- Mix.Task.run("app.start")
-
- with {:ok, token} <- Pleroma.UserInviteToken.create_token() do
- Mix.shell().info("Generated user invite token")
-
- url =
- Pleroma.Web.Router.Helpers.redirect_url(
- Pleroma.Web.Endpoint,
- :registration_page,
- token.token
- )
-
- IO.puts("URL: #{url}")
- else
- _ ->
- Mix.shell().error("Could not create invite token.")
- end
- end
-end
@moduledoc """
Manages Pleroma instance.
- ## Generate a new instance.
+ ## Generate a new instance config.
mix pleroma.instance new [OPTION...]
end
end
+
defp escape_sh_path(path) do
~S(') <> String.replace(path, ~S('), ~S(\')) <> ~S(')
end
- `--password PASSWORD` - the user's password
- `--moderator`/`--no-moderator` - whether the user is a moderator
- `--admin`/`--no-admin` - whether the user is an admin
+
+ ## Generate an invite link.
+
+ mix pleroma.user invite
## Delete the user's account.
end
end
+ def run(["invite"]) do
+ Mix.Task.run("app.start")
+
+ with {:ok, token} <- Pleroma.UserInviteToken.create_token() do
+ Mix.shell().info("Generated user invite token")
+
+ url =
+ Pleroma.Web.Router.Helpers.redirect_url(
+ Pleroma.Web.Endpoint,
+ :registration_page,
+ token.token
+ )
+
+ IO.puts(url)
+ else
+ _ ->
+ Mix.shell().error("Could not create invite token.")
+ end
+
+ end
defp set_locked(nickname, value) do
Mix.Ecto.ensure_started(Repo, [])