diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2024-11-19 23:15:55 +0100 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2024-11-19 23:15:55 +0100 |
commit | 5324a38f8fbd41391741317f7e7ab2d69ec30623 (patch) | |
tree | 7a6ff48bb8dece79ac782977e510bb5bd048fc21 /src/jwebmail/read_mails.py | |
parent | ae117909d9f39103e32296325e93fa3c22749350 (diff) |
switch from protobuf based protocol to varlink
Diffstat (limited to 'src/jwebmail/read_mails.py')
-rw-r--r-- | src/jwebmail/read_mails.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/jwebmail/read_mails.py b/src/jwebmail/read_mails.py index 54bd139..7775b12 100644 --- a/src/jwebmail/read_mails.py +++ b/src/jwebmail/read_mails.py @@ -5,7 +5,7 @@ from os.path import join as path_join from flask import current_app, g from flask_login import UserMixin, current_user, login_user -from .model.read_mails import QMailAuthuser +from .model.read_mails import QMailAuthuser, QMAuthError EXPIRATION_SEC = 60 * 60 * 25 @@ -163,8 +163,15 @@ def _build_qma(username, password): def login(username, password): - if not _build_qma(username, password).verify_user(): - return False + try: + qma = _build_qma(username, password).open() + except QMAuthError as err: + if err.rc == 1: + return False + else: + raise + finally: + qma.close() r = _select_timeout_session() r.set(username, password) r.close() @@ -186,6 +193,6 @@ def get_read_mails_logged_in(): if "read_mails" in g: return g.read_mails - qma = _build_qma(current_user.get_id(), current_user.password) + qma = _build_qma(current_user.get_id(), current_user.password).open() g.read_mails = qma return qma |