Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85627808
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/lib/pleroma/web/plugs/cookie_auth_plug.ex b/lib/pleroma/web/plugs/cookie_auth_plug.ex
index dd5153cd4..7e5b23040 100644
--- a/lib/pleroma/web/plugs/cookie_auth_plug.ex
+++ b/lib/pleroma/web/plugs/cookie_auth_plug.ex
@@ -1,28 +1,27 @@
# Pleroma: A lightweight social networking server
# Copyright © 2017-2020 Pleroma Authors <https://pleroma.social/>
# SPDX-License-Identifier: AGPL-3.0-only
defmodule Pleroma.Web.Plugs.CookieAuthPlug do
alias Pleroma.User
import Plug.Conn
def init(opts) do
opts
end
# If the user is already assigned (by a bearer token, probably), skip ahead.
- def call(%{assigns: %{user: _}} = conn, _), do: conn
+ def call(%{assigns: %{user: %User{}}} = conn, _), do: conn
# Authenticate with a session cookie, if available.
# For staticly-rendered pages (like the OAuth form)
# this is the only way it can authenticate.
def call(conn, _) do
- with user_id <- get_session(conn, :user_id),
- true <- is_binary(user_id),
+ with user_id when is_binary(user_id) <- get_session(conn, :user_id),
%User{} = user <- User.get_by_id(user_id) do
assign(conn, :user, user)
else
_ -> conn
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Aug 8, 4:32 AM (9 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1722892
Default Alt Text
(1 KB)
Attached To
Mode
rPUBE pleroma-upstream
Attached
Detach File
Event Timeline
Log In to Comment