crafty-4/app/classes/web/routes/api/auth/invalidate_tokens.py
Zedifus 45c3f73eca Revert "Revert "Merge branch 'dev' into 'master'""
This reverts the 4.4.1 release revert commit 29ce7a2cdeb59b4d769f4b107a24cece44b7a214.
2024-08-06 20:45:00 +01:00

20 lines
593 B
Python

import logging
from app.classes.web.base_api_handler import BaseApiHandler
from app.classes.shared.helpers import Helpers
logger = logging.getLogger(__name__)
class ApiAuthInvalidateTokensHandler(BaseApiHandler):
def post(self):
auth_data = self.authenticate_user()
if not auth_data:
return
logger.debug(f"Invalidate tokens for user {auth_data[4]['user_id']}")
self.controller.users.raw_update_user(
auth_data[4]["user_id"], {"valid_tokens_from": Helpers.get_utc_now()}
)
self.finish_json(200, {"status": "ok"})