[#3112] Ensured presence and consistency of :user and :token assigns (EnsureUserTokenAssignsPlug). Refactored auth info dropping functions.

This commit is contained in:
Ivan Tashkinov 2020-12-06 13:59:10 +03:00
commit e9859b68fc
14 changed files with 178 additions and 131 deletions

View file

@ -11,12 +11,10 @@ defmodule Pleroma.Web.Plugs.UserEnabledPlug do
end
def call(%{assigns: %{user: %User{} = user}} = conn, _) do
case User.account_status(user) do
:active ->
conn
_ ->
AuthHelper.drop_auth_info(conn)
if User.account_status(user) == :active do
conn
else
AuthHelper.drop_auth_info(conn)
end
end