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

Proper handling and sanitizing user inputs when creating game #10

Merged
merged 2 commits into from
Oct 26, 2024

Conversation

Oskarowski
Copy link
Owner

Description

This pull request addresses two key improvements in the game settings form:

  1. Input Validation:

    • Added validation to ensure that the grid size and mines amount are within acceptable ranges on client and server side.
    • Set the maximum grid size to 22x22.
    • Set max mines amount to gridSize * 0.8
    • Implemented checks to handle cases where the user might input excessively large values for grid size, preventing potential server crashes.
    • The max mines amount is dynamically calculated based on grid size and displayed to the user.
    • The mines amount is now validated to ensure it falls within the range of 1 to a maximum determined by the grid size.
  2. JavaScript Refactor:

    • Moved JavaScript functions responsible for toggling visibility and adjusting the mines input field range to a separate file.

Found the problem when trying to create the 61st game; the session cookie exceeds its maximum memory value, as described in #9.

@Oskarowski Oskarowski merged commit 336d5c1 into master Oct 26, 2024
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