It turns out this is due to a known issue with flask-login (using flags) when the login flag is used with a session storage library such as KVSession.
Basically, KVSession needs to update the database with new session information when the data in the session is created or modified. And in the above example, this happens correctly: the first time I click on the page, the session is created. After that, the existing session is updated.
However, in the background, the browser sends a cookie-less request to my web server that requires my icon. Therefore, the bulb processes the request /favicon.ico . This request (or any other request that will be 404) is still being processed by the bulb. This means that the login checkbox will look at the request and try to do its magic.
It so happens that the login checkbox does not try to insert anything into the session, but it still WATCHES how the session was changed in relation to KVSession. Since it SEEES as a session change, KVSession updates the database. Below is the code from the login checkbox:
def _update_remember_cookie(self, response): operation = session.pop("remember", None) ...
The _update_remember_cookie method _update_remember_cookie called during the request life cycle. Although session.pop will not change the session if there is no βrememberβ key in the session (which it does not do in this case), KVSession still sees the pop and assumes that the session is changing.
The problem for flask-login provides a simple bug fix, but it was not entered into the flash drive login. It seems that the attendant is looking for a complete correspondence and implements it there.
source share