From 7d010063a985835b3109697d71b0fa5b223a4601 Mon Sep 17 00:00:00 2001 From: Tnix Date: Tue, 10 Sep 2024 01:13:45 +1200 Subject: [PATCH] add back account restoration --- sessions.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sessions.py b/sessions.py index 259db64..a5e9b5d 100644 --- a/sessions.py +++ b/sessions.py @@ -29,6 +29,15 @@ def __init__(self, data: AccSessionDB): @classmethod def create(cls: "AccSession", user: str, ip: str, user_agent: str) -> "AccSession": + # restore account if it is pending deletion + result = db.usersv0.update_one({"_id": user}, {"$set": {"delete_after": None}}) + if result.modified_count: + rdb.publish("admin", msgpack.packb({ + "op": "alert_user", + "user": user, + "content": "Your account was scheduled for deletion but you logged back in. Your account is no longer scheduled for deletion! If you didn't request for your account to be deleted, please change your password immediately." + })) + data: AccSessionDB = { "_id": str(uuid.uuid4()), "user": user,