Add registration to the TwAPI controller.
This commit is contained in:
parent
b1edd94baa
commit
5dac3727f1
3 changed files with 50 additions and 0 deletions
|
|
@ -26,6 +26,7 @@ defmodule Pleroma.Web.Router do
|
|||
get "/statuses/show/:id", TwitterAPI.Controller, :fetch_status
|
||||
get "/statusnet/conversation/:id", TwitterAPI.Controller, :fetch_conversation
|
||||
get "/statusnet/config", TwitterAPI.Controller, :config
|
||||
post "/account/register", TwitterAPI.Controller, :register
|
||||
end
|
||||
|
||||
scope "/api", Pleroma.Web do
|
||||
|
|
|
|||
|
|
@ -131,6 +131,17 @@ defmodule Pleroma.Web.TwitterAPI.Controller do
|
|||
|> json_reply(200, response)
|
||||
end
|
||||
|
||||
def register(conn, params) do
|
||||
with {:ok, user} <- TwitterAPI.register_user(params) do
|
||||
conn
|
||||
|> json_reply(200, Poison.encode!(user))
|
||||
else
|
||||
{:error, errors} ->
|
||||
conn
|
||||
|> json_reply(400, Poison.encode!(errors))
|
||||
end
|
||||
end
|
||||
|
||||
defp json_reply(conn, status, json) do
|
||||
conn
|
||||
|> put_resp_content_type("application/json")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue