From b0df35eba0dc841bdcab3d663d6a1fb210851181 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Sp=C3=B6ttel?= <1682504+fspoettel@users.noreply.github.com> Date: Thu, 3 Sep 2020 20:39:03 +0200 Subject: [PATCH] conn.close() if mru_token update can't .commit() --- management/mailconfig.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/management/mailconfig.py b/management/mailconfig.py index 7f4cec3..c1a083e 100755 --- a/management/mailconfig.py +++ b/management/mailconfig.py @@ -576,7 +576,9 @@ def set_mru_totp_code(email, token, env): c.execute('UPDATE totp_credentials SET mru_token=? WHERE user_email=?', (token, email)) if c.rowcount != 1: + conn.close() raise ValueError("That's not a user (%s)." % email) + conn.commit() return "OK"