MastodonAPI: Add sign out.

Close #79
This commit is contained in:
Roger Braun 2017-11-19 13:23:16 +01:00
parent 40ca379357
commit 0f099dac67
2 changed files with 11 additions and 4 deletions

View File

@ -583,6 +583,12 @@ def login_post(conn, %{"authorization" => %{ "name" => name, "password" => passw
end end
end end
def logout(conn, _) do
conn
|> clear_session
|> redirect(to: "/")
end
def relationship_noop(%{assigns: %{user: user}} = conn, %{"id" => id}) do def relationship_noop(%{assigns: %{user: user}} = conn, %{"id" => id}) do
Logger.debug("Unimplemented, returning unmodified relationship") Logger.debug("Unimplemented, returning unmodified relationship")
with %User{} = target <- Repo.get(User, id) do with %User{} = target <- Repo.get(User, id) do

View File

@ -223,12 +223,13 @@ def user_fetcher(username) do
get "/webfinger", WebFinger.WebFingerController, :webfinger get "/webfinger", WebFinger.WebFingerController, :webfinger
end end
scope "/web", Pleroma.Web.MastodonAPI do scope "/", Pleroma.Web.MastodonAPI do
pipe_through :mastodon_html pipe_through :mastodon_html
get "/login", MastodonAPIController, :login get "/web/login", MastodonAPIController, :login
post "/login", MastodonAPIController, :login_post post "/web/login", MastodonAPIController, :login_post
get "/*path", MastodonAPIController, :index get "/web/*path", MastodonAPIController, :index
delete "/auth/sign_out", MastodonAPIController, :logout
end end
scope "/", Fallback do scope "/", Fallback do