We don't have a clear specification on how session handling (logging in and out) works. Currently, the code doesn't really make sense in this aspect.
Below is a suggestion on how it might work. Please comment if it doesn't seem reasonable!
Checking if user is logged in: read the backend session object.
Logging in: Run LoginJob, passing credentials (specified by user in GUI) as parameters. If successful, report back AND save the credentials to settings.
If session expires: Login in the background, with credentials from settings.
We don't have a clear specification on how session handling (logging in and out) works. Currently, the code doesn't really make sense in this aspect.
Below is a suggestion on how it might work. Please comment if it doesn't seem reasonable!