Session-based OAuth auth fixes (token expiration check), refactoring, tweaks.
This commit is contained in:
parent
73e66fd31f
commit
ccc2cf0e87
11 changed files with 164 additions and 196 deletions
|
|
@ -3,7 +3,7 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
defmodule Pleroma.Web.Plugs.UserEnabledPlug do
|
||||
import Plug.Conn
|
||||
alias Pleroma.Helpers.AuthHelper
|
||||
alias Pleroma.User
|
||||
|
||||
def init(options) do
|
||||
|
|
@ -12,8 +12,11 @@ defmodule Pleroma.Web.Plugs.UserEnabledPlug do
|
|||
|
||||
def call(%{assigns: %{user: %User{} = user}} = conn, _) do
|
||||
case User.account_status(user) do
|
||||
:active -> conn
|
||||
_ -> assign(conn, :user, nil)
|
||||
:active ->
|
||||
conn
|
||||
|
||||
_ ->
|
||||
AuthHelper.drop_auth_info(conn)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue