2018-06-17 05:30:07 -06:00
|
|
|
defmodule Mix.Tasks.GenerateInviteToken do
|
|
|
|
use Mix.Task
|
|
|
|
|
2018-08-12 05:11:08 -06:00
|
|
|
@shortdoc "Generate invite token for user"
|
2018-06-17 05:30:07 -06: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
|