Skip to content

Fix misleading failed-login log entries when login-email is enabled#30

Open
gebeer wants to merge 1 commit into
ryancramerdesign:masterfrom
gebeer:fix/log-spam
Open

Fix misleading failed-login log entries when login-email is enabled#30
gebeer wants to merge 1 commit into
ryancramerdesign:masterfrom
gebeer:fix/log-spam

Conversation

@gebeer

@gebeer gebeer commented Mar 8, 2026

Copy link
Copy Markdown

Summary

When login-email is enabled, LoginRegister currently attempts to log in with emailToName($email) first, and only then falls back to looking up the user by email and retrying with the real username.

For installs where the actual username does not match the email-derived page name, this produces a misleading failed login entry in session.txt even though the login succeeds on the second attempt.

Example:

  • Error: Failed login for 'admin-hugoerke.de' - Unknown user
  • Successful login for 'hg-admin'

Fix

When login-email is enabled and the submitted login value looks like an email address, resolve it to the actual user name before calling Session::login().

Behavior after this change:

  • login-email enabled + one matching email: log in once with the real username
  • login-email enabled + multiple matching emails: keep the existing duplicate-email error
  • any non-email input: keep the existing username login behavior
  • login-email disabled: keep the existing username login behavior

This avoids false failed-login log entries for successful email logins without changing behavior for installations that do not use login-email.

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