projects
/
akkoma
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Merge branch 'feature/rich-text-optout-backend' into 'develop'
[akkoma]
/
lib
/
pleroma
/
plugs
/
ensure_authenticated_plug.ex
1
defmodule Pleroma.Plugs.EnsureAuthenticatedPlug do
2
import Plug.Conn
3
alias Pleroma.User
4
5
def init(options) do
6
options
7
end
8
9
def call(%{assigns: %{user: %User{}}} = conn, _) do
10
conn
11
end
12
13
def call(conn, _) do
14
conn
15
|> put_resp_content_type("application/json")
16
|> send_resp(403, Jason.encode!(%{error: "Invalid credentials."}))
17
|> halt
18
end
19
end