Skip to content

fix: handle empty database on user registration#89

Open
Luna161 wants to merge 1 commit into
Jespermagician:mainfrom
Luna161:fix/43-register-empty-db
Open

fix: handle empty database on user registration#89
Luna161 wants to merge 1 commit into
Jespermagician:mainfrom
Luna161:fix/43-register-empty-db

Conversation

@Luna161
Copy link
Copy Markdown

@Luna161 Luna161 commented May 9, 2026

Closes #43

When no users exist in the database, MAX(iduser) returns NULL and the raw query loop produces no rows, leaving UserID as None. This caused registration to fail with 'User couldn't be created'.

Fix:

  • Initialize UserID = 1 as default (first user gets ID 1)
  • Simplified the ID assignment logic
  • Parametrized the email duplicate check query (SQL injection prevention)
  • Removed debug print() statements from RegisterUser

When no users exist in the database, MAX(iduser) returns NULL and
the loop produces no rows, leaving UserID as None. This caused the
registration to fail with 'User couldn't be created'.

Fix: Initialize UserID = 1 as default. Also parametrize the email
lookup query and remove debug print statements.

Closes Jespermagician#43
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.

Error by User Register, if no user exists

1 participant