conn.close() if mru_token update can't .commit()

This commit is contained in:
Felix Spöttel 2020-09-03 20:39:03 +02:00
parent 08ae3d2b7f
commit b0df35eba0
1 changed files with 2 additions and 0 deletions

View File

@ -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"