admin_api_controller.ex: Add documentation, fix get_invite_token

This commit is contained in:
Haelwenn (lanodan) Monnier 2018-10-12 06:37:37 +02:00
parent 578a911737
commit 95b107b6cc
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE

View file

@ -55,13 +55,15 @@ def relay_unfollow(conn, %{relay_url: target}) do
|> send(200) |> send(200)
end end
@shortdoc "Get a account registeration invite token (base64 string)"
def get_invite_token(conn, _params) do def get_invite_token(conn, _params) do
{:ok, token} <- Pleroma.UserInviteToken.create_token() {:ok, token} <- Pleroma.UserInviteToken.create_token()
conn conn
|> puts(token) |> json(token.token)
end end
@shortdoc "Get a password reset token (base64 string) for given nickname"
def get_password_reset(conn, %{"nickname" => nickname}) do def get_password_reset(conn, %{"nickname" => nickname}) do
(%User{local: true} = user) = User.get_by_nickname(nickname) (%User{local: true} = user) = User.get_by_nickname(nickname)
{:ok, token} = Pleroma.PasswordResetToken.create_token(user) {:ok, token} = Pleroma.PasswordResetToken.create_token(user)