logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma
commit: 0f099dac673e707726b8498d6b56fa6f509e9467
parent: 40ca3793578fc505200a1c975cafce15a3b265c7
Author: Roger Braun <roger@rogerbraun.net>
Date:   Sun, 19 Nov 2017 13:23:16 +0100

MastodonAPI: Add sign out.

Close #79

Diffstat:

Mlib/pleroma/web/mastodon_api/mastodon_api_controller.ex6++++++
Mlib/pleroma/web/router.ex9+++++----
2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex b/lib/pleroma/web/mastodon_api/mastodon_api_controller.ex @@ -583,6 +583,12 @@ defmodule Pleroma.Web.MastodonAPI.MastodonAPIController do end end + def logout(conn, _) do + conn + |> clear_session + |> redirect(to: "/") + end + def relationship_noop(%{assigns: %{user: user}} = conn, %{"id" => id}) do Logger.debug("Unimplemented, returning unmodified relationship") with %User{} = target <- Repo.get(User, id) do diff --git a/lib/pleroma/web/router.ex b/lib/pleroma/web/router.ex @@ -223,12 +223,13 @@ defmodule Pleroma.Web.Router do get "/webfinger", WebFinger.WebFingerController, :webfinger end - scope "/web", Pleroma.Web.MastodonAPI do + scope "/", Pleroma.Web.MastodonAPI do pipe_through :mastodon_html - get "/login", MastodonAPIController, :login - post "/login", MastodonAPIController, :login_post - get "/*path", MastodonAPIController, :index + get "/web/login", MastodonAPIController, :login + post "/web/login", MastodonAPIController, :login_post + get "/web/*path", MastodonAPIController, :index + delete "/auth/sign_out", MastodonAPIController, :logout end scope "/", Fallback do