Skip to content

Conversation

devogs
Copy link
Owner

@devogs devogs commented Sep 8, 2025

This pull request addresses a critical bug where the application would crash when a user entered an unknown email address on the login page. The original code assumed a club would always be found in the clubs list and attempted to access the first element, which would cause an IndexError if the list was empty.

This fix modifies the showSummary() function in server.py to correctly handle this exception.

Changes Made:

Error Handling: The code now checks if the found_clubs list is empty.

User Feedback: If no club is found, a flash message "Sorry, that email was not found." is displayed to the user.

Redirection: The user is then redirected back to the index page to try again.

Session Management: The session is cleared to ensure no invalid user data persists.

Verification:

Manual Test: I manually tested the fix by entering an unknown email, and the application now redirects to the home page with the correct error message displayed.

Automated Test: The test_unknown_email_flashes_message() test in tests/test_login.py now passes successfully, confirming the fix. This test case was written specifically to encapsulate the problem and its solution.

@devogs devogs merged commit 1dabf6b into master Sep 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant