Log in properly and clear cookies on failure

Just because we say we're logged in doesn't mean we actually are logged in.
This commit is contained in:
Thomas Wade 2020-04-22 17:33:39 +09:30
parent 398f6fe341
commit cd6cbd9948
2 changed files with 2 additions and 5 deletions

View File

@ -467,10 +467,6 @@ class FAAPI:
:param cookies: Cookies to use for this session. :param cookies: Cookies to use for this session.
:return: Whether the login attempt was successful. :return: Whether the login attempt was successful.
""" """
if self.logged_in:
# No need to do anything if we're already logged in
return True
if cookies: if cookies:
self._cookies = cookies self._cookies = cookies
elif not self._cookies: elif not self._cookies:
@ -496,6 +492,7 @@ class FAAPI:
except IndexError: except IndexError:
# Not logged in # Not logged in
self.logged_in = False self.logged_in = False
self._cookies = None
return False return False
# Mark this instance as logged in # Mark this instance as logged in

View File

@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup( setup(
name='FAAPI', name='FAAPI',
version='0.5.3', version='0.5.4',
packages=find_packages(), packages=find_packages(),
url='https://tem.party/gitea/tom/FAAPI', url='https://tem.party/gitea/tom/FAAPI',
license='WTFPL', license='WTFPL',