Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terminal timeout causes system hang when debtor doesn't click "Logout" button after purchase #343

Open
westbl opened this issue Oct 18, 2019 · 1 comment
Assignees
Labels

Comments

@westbl
Copy link
Contributor

westbl commented Oct 18, 2019

If someone in debt is presented with the two-step purchase/logout and clicks "Purchase" but never clicks "Logout", when the system attempts to do the auto-logout after the timeout expires the "Logout" button is disabled but the screen never changes.

After local debugging, I discovered that the problem lies in how the cart is handled; after completing a purchase by clicking "Purchase", the cart still exists but the id field is invalid/unknown. The timeout function then detects a non-empty cart (since there are still items visible in the webpage) and runs the purchase_submit function, which throws an exception upon discovering that the "id" field is undefined in this line:

var pid = id.split('-')[2];

As a temporary fix I added a try-catch block around the purchase_submit function which simply switches the screen if an exception is thrown, but that is not a long-term solution.

@westbl westbl added the bug label Oct 18, 2019
westbl added a commit that referenced this issue Oct 18, 2019
@westbl
Copy link
Contributor Author

westbl commented Oct 18, 2019

I updated the fix in commit 6283f57 to be a bit less hacky; it now checks if the purchase is complete along with the "are any items in the cart" check when processing a timeout. Since the purchase was completed in this situation, it will see that and ignore the fact that there are "items" in the cart. Still not perfect, but at least it doesn't throw exceptions for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants