8000 Improve login error message and reject empty credentials by BibaPutt · Pull Request #774 · digininja/DVWA · GitHub
[go: up one dir, main page]

Improve login error message and reject empty credentials - #774

Merged
digininja merged 2 commits into
digininja:masterfrom
BibaPutt:fix/improved-login-validation
Oct 7, 2026
Merged

digininja merged 2 commits into
digininja:masterfrom
BibaPutt:fix/improved-login-validation

Conversation

@BibaPutt
@BibaPutt BibaPutt commented Oct 6, 2026 •
Copy link
Copy Markdown
Contributor

What

Improves the login error handling in login.php: blank username/password submissions are rejected with a clear message before the database is queried, and the failure message is a single generic string.

Why

Previously any failed login showed a bare 'Login failed' message and empty input still hit the database. The generic message also avoids revealing whether the username or the password was wrong (user enumeration).

How to verify

  • Submit the login form with empty / whitespace-only fields: 'Username and password cannot be empty. Login failed.' is shown.
  • Wrong credentials: 'Login failed. Please check your username and password.'
  • Valid credentials log in exactly as before (single file change, +11/-2 in login.php).

@digininja
Copy link
Copy Markdown
Owner

The error message is already generic, all you've added is an extra few words from what I can tell. As it's not changing any functionality I think leave it as it is in case anyone has built tutorials based on those words.

I don't mind the check to see if the creds are empty, if you can separate that out it can stay.

@BibaPutt
BibaPutt force-pushed the fix/improved-login-validation branch from 297431c to 49b6fe9 Compare October 7, 2026 02:05
@BibaPutt
BibaPutt commented Oct 7, 2026
Copy link
Copy Markdown
Contributor Author

Fair point, thanks for looking. I've dropped the rewording, the original 'Login failed' message is back untouched. What's left is only the empty-credentials check, which skips the database query and shows 'Username and password cannot be empty. Login failed.' Let me know if you'd like anything else adjusted.

@digininja
Copy link
Copy Markdown
Owner

Remove the generic message comment on line 30 and all is good.

@digininja
digininja merged commit 068d974 into digininja:master Oct 7, 2026
1 check passed
@digininja
Copy link
Copy Markdown
Owner

thanks

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.

2 participants

0