diff options
author | Roger Braun <roger@rogerbraun.net> | 2017-11-19 13:23:16 +0100 |
---|---|---|
committer | Roger Braun <roger@rogerbraun.net> | 2017-11-19 13:23:16 +0100 |
commit | 0f099dac673e707726b8498d6b56fa6f509e9467 (patch) | |
tree | 19304b64656ae87d01a388c656eedfb9ba69dba2 /lib | |
parent | 40ca3793578fc505200a1c975cafce15a3b265c7 (diff) | |
download | pleroma-0f099dac673e707726b8498d6b56fa6f509e9467.tar.gz |
MastodonAPI: Add sign out.
Close #79
Diffstat (limited to 'lib')
-rw-r--r-- | lib/pleroma/web/mastodon_api/mastodon_api_controller.ex | 6 | ||||
-rw-r--r-- | lib/pleroma/web/router.ex | 9 |
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 index ca1e4c8d5..9c50e850b 100644 --- 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 index beca1581e..f3c476fdc 100644 --- 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 |