2018-06-17 11:30:07 +00:00
|
|
|
defmodule Mix.Tasks.GenerateInviteToken do
|
|
|
|
use Mix.Task
|
|
|
|
|
2018-11-02 08:32:48 +00:00
|
|
|
@moduledoc """
|
|
|
|
Generates invite token
|
|
|
|
|
|
|
|
This is in the form of a URL to be used by the Invited user to register themselves.
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
``mix generate_invite_token``
|
|
|
|
"""
|
2018-06-17 11:30:07 +00:00
|
|
|
def run([]) do
|
|
|
|
Mix.Task.run("app.start")
|
|
|
|
|
|
|
|
with {:ok, token} <- Pleroma.UserInviteToken.create_token() do
|
|
|
|
IO.puts("Generated user invite token")
|
|
|
|
|
|
|
|
IO.puts(
|
|
|
|
"Url: #{
|
|
|
|
Pleroma.Web.Router.Helpers.redirect_url(
|
|
|
|
Pleroma.Web.Endpoint,
|
|
|
|
:registration_page,
|
|
|
|
token.token
|
|
|
|
)
|
|
|
|
}"
|
|
|
|
)
|
|
|
|
else
|
|
|
|
_ ->
|
|
|
|
IO.puts("Error creating token")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|