diff options
Diffstat (limited to 'src/jwebmail/read_mails.py')
-rw-r--r-- | src/jwebmail/read_mails.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/jwebmail/read_mails.py b/src/jwebmail/read_mails.py index 01252ee..44eba8d 100644 --- a/src/jwebmail/read_mails.py +++ b/src/jwebmail/read_mails.py @@ -61,11 +61,18 @@ class MysqlTimeoutSession: cur.execute("DELETE FROM session WHERE timeout < NOW()") cur.execute("SELECT password FROM session WHERE user = %s", [key]) row = cur.fetchone() - self.conn.commit() - cur.close() + if row is None: + self.conn.commit() + cur.close() return None else: + timeout = datetime.now() + timedelta(seconds=self.timeout) + cur.execute( + "UPDATE session SET timeout = %s WHERE user = %s", [timeout, key] + ) + self.conn.commit() + cur.close() return row[0] |