diff options
Diffstat (limited to 'src/jwebmail')
-rw-r--r-- | src/jwebmail/__init__.py | 2 | ||||
-rw-r--r-- | src/jwebmail/model/read_mails.py | 4 | ||||
-rw-r--r-- | src/jwebmail/read_mails.py | 2 | ||||
-rw-r--r-- | src/jwebmail/webmail.py | 7 |
4 files changed, 8 insertions, 7 deletions
diff --git a/src/jwebmail/__init__.py b/src/jwebmail/__init__.py index 7bc1093..665d85c 100644 --- a/src/jwebmail/__init__.py +++ b/src/jwebmail/__init__.py @@ -35,7 +35,7 @@ else: toml_read_file = dict(load=toml_load, text=True) -__version__ = "2.0.0.dev3" +__version__ = "2.0.0.dev4" def validate_config(app): diff --git a/src/jwebmail/model/read_mails.py b/src/jwebmail/model/read_mails.py index 291fa1e..ccd9bb9 100644 --- a/src/jwebmail/model/read_mails.py +++ b/src/jwebmail/model/read_mails.py @@ -27,13 +27,13 @@ class QMailAuthuser: try: completed_proc = subprocess_run( f"{self._authenticator} true 3<&0", - input=f"{self._username}\0{self._password}\0\0".encode(), shell=True, timeout=2, + input=f"{self._username}\0{self._password}\0\0".encode(), ) if completed_proc.returncode == 0: return True - if completed_proc.returncode == 1: + elif completed_proc.returncode == 1: return False else: raise QMAuthError("authentication error", completed_proc.returncode) diff --git a/src/jwebmail/read_mails.py b/src/jwebmail/read_mails.py index 915567c..e010a7d 100644 --- a/src/jwebmail/read_mails.py +++ b/src/jwebmail/read_mails.py @@ -51,7 +51,7 @@ def load_user(username: str) -> JWebmailUser: username="jwebmail", password=passwd, ) - passwd = r.getex(f"jwm:user:{username}", EXPIRATION_SEC) + passwd = r.get(f"jwm:user:{username}") # EXPIRATION_SEC if passwd is None: return None return JWebmailUser(username, passwd) diff --git a/src/jwebmail/webmail.py b/src/jwebmail/webmail.py index 26dfe20..5ddc5d6 100644 --- a/src/jwebmail/webmail.py +++ b/src/jwebmail/webmail.py @@ -10,7 +10,7 @@ from flask import ( request, url_for, ) -from flask_babel import gettext, lazy_gettext +from flask_babel import get_locale, gettext, lazy_gettext from flask_login import current_user, login_user, logout_user from flask_paginate import Pagination, get_page_parameter, get_per_page_parameter from flask_wtf import FlaskForm @@ -66,8 +66,9 @@ def login(): if urlparse(nxt).netloc: abort(401) - g.setdefault("lang_code", current_app.config["BABEL_DEFAULT_LOCALE"]) - return redirect(nxt or url_for("displayheaders"), 303) + return redirect( + nxt or url_for("displayheaders", lang_code=get_locale().language), 303 + ) else: warn = gettext("login failed!") elif request.method == "POST": |