diff options
Diffstat (limited to 'src/jwebmail/read_mails.py')
-rw-r--r-- | src/jwebmail/read_mails.py | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/jwebmail/read_mails.py b/src/jwebmail/read_mails.py index 915567c..2d2b26c 100644 --- a/src/jwebmail/read_mails.py +++ b/src/jwebmail/read_mails.py @@ -42,14 +42,14 @@ def add_user(user: JWebmailUser): def load_user(username: str) -> JWebmailUser: - passwd = current_app.config["JWEBMAIL"]["READ_MAILS"]["SESSION_STORE_PASSWD"] + ss_password = current_app.config["JWEBMAIL"]["READ_MAILS"]["SESSION_STORE_PASSWD"] r = redis.Redis( host="localhost", port=6379, decode_responses=True, protocol=3, username="jwebmail", - password=passwd, + password=ss_password, ) passwd = r.getex(f"jwm:user:{username}", EXPIRATION_SEC) if passwd is None: @@ -61,19 +61,6 @@ def get_read_mails_logged_in(): if "read_mails" in g: return g.read_mails - passwd = current_app.config["JWEBMAIL"]["READ_MAILS"]["SESSION_STORE_PASSWD"] - r = redis.Redis( - host="localhost", - port=6379, - decode_responses=True, - protocol=3, - username="jwebmail", - password=passwd, - ) - passwd = r.get(f"jwm:user:{current_user.get_id()}") - if passwd is None: - raise KeyError(current_user.get_id()) - - qma = build_qma(current_user.get_id(), passwd) + qma = build_qma(current_user.get_id(), current_user.password) g.read_mails = qma return qma |