Skip to content

Commit

Permalink
Remove RequireLogoutProcessor (#10449)
Browse files Browse the repository at this point in the history
* Remove `RequireLogoutProcessor`

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jimchamp and pre-commit-ci[bot] authored Feb 13, 2025
1 parent 77d6d80 commit 1606a0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
3 changes: 2 additions & 1 deletion openlibrary/plugins/openlibrary/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
delegate.app.add_processor(processors.ProfileProcessor())
delegate.app.add_processor(processors.CORSProcessor(cors_prefixes={'/api/'}))
delegate.app.add_processor(processors.PreferenceProcessor())
delegate.app.add_processor(processors.RequireLogoutProcessor())
# Refer to https://github.com/internetarchive/openlibrary/pull/10005 to force patron's to login
# delegate.app.add_processor(processors.RequireLogoutProcessor())

try:
from infogami.plugins.api import code as api
Expand Down
19 changes: 0 additions & 19 deletions openlibrary/plugins/openlibrary/processors.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
"""web.py application processors for Open Library."""

import re
from datetime import datetime

import web

from infogami.core.code import logout as infogami_logout
from openlibrary.accounts import get_current_user
from openlibrary.core import helpers as h
from openlibrary.core.processors import (
Expand Down Expand Up @@ -112,23 +110,6 @@ def __call__(self, handler):
return handler()


cutoff = '2024-11-07T18:00:00'
stale_date = datetime.fromisoformat(cutoff)


class RequireLogoutProcessor:

def __call__(self, handler):
if session_cookie := web.cookies().get("session"):
split_cookie = session_cookie.split(",")
create_date = datetime.fromisoformat(split_cookie[1])

if create_date < stale_date:
infogami_logout().POST()

return handler()


if __name__ == "__main__":
import doctest

Expand Down

0 comments on commit 1606a0d

Please sign in to comment.