diff options
Diffstat (limited to 'src/jwebmail/webmail.py')
-rw-r--r-- | src/jwebmail/webmail.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/jwebmail/webmail.py b/src/jwebmail/webmail.py index 1b61daa..84cb6a7 100644 --- a/src/jwebmail/webmail.py +++ b/src/jwebmail/webmail.py @@ -36,7 +36,7 @@ from .render_mail import to_mime_type class LoginForm(FlaskForm): username = StringField(lazy_gettext("Username"), [validators.Email()]) password = PasswordField( - lazy_gettext("Password"), [validators.Length(min=5, max=35)] + lazy_gettext("Password"), [validators.Length(min=5, max=120)] ) @@ -186,6 +186,18 @@ def writemail(): return render_template("writemail.html", form=WriteForm()) +def _take_common_req_args(mapping): + print(mapping) + res = dict() + if mapping.get("sort"): + res["sort"] = mapping["sort"] + if mapping.get("per_page"): + res["per_page"] = mapping["per_page"] + if mapping.get("page"): + res["page"] = mapping["page"] + return res + + def move(folder=""): folders = get_read_mails_logged_in().folders() @@ -199,7 +211,8 @@ def move(folder=""): get_read_mails_logged_in().move(m, folder, to_folder) flash(gettext("succ_move")) - return redirect(url_for("displayheaders", folder=folder), 303) + args = _take_common_req_args(request.form) + return redirect(url_for("displayheaders", folder=folder, **args), 303) def remove(folder=""): @@ -220,7 +233,8 @@ def remove(folder=""): get_read_mails_logged_in().move(m, folder, "Trash") flash(gettext("succ_remove")) - return redirect(url_for("displayheaders", folder=folder), 303) + args = _take_common_req_args(request.form) + return redirect(url_for("displayheaders", folder=folder, **args), 303) def sendmail(): |