craftcms / craftcms/cms

[4.x]: /admin wrong password results in undefined error

Open
#13,786 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug craft4
Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

What happened?
Description

So on a site if you try to login into the cms and you enter a faulty password you get the undefined error:
Screenshot 2023-10-05 at 11 38 17

We do have a custom login url here instead of /admin however changing this has no effect.
Our general.php looks like this:
return GeneralConfig::create() ->limitAutoSlugsToAscii() ->convertFilenamesToAscii() ->enableGql(false) // Prevent generated URLs from including "index.php" ->omitScriptNameInUrls() ->useEmailAsUsername() // Set the default week start day for date pickers (0 = Sunday, 1 = Monday, etc.) ->defaultWeekStartDay(1) // Enable Dev Mode ->devMode(App::env('DEV_MODE') ?? false) // Allow administrative changes ->allowAdminChanges(App::env('ALLOW_ADMIN_CHANGES') ?? false) // Allow updates ->allowUpdates(App::env('ALLOW_UPDATES') ?? false) ->userSessionDuration(7200) // Disallow robots ->disallowRobots(App::env('DISALLOW_ROBOTS') ?? true) ->cpTrigger('prodelta-admin') ->aliases([ '@assetBaseUrl' => getenv('ASSET_BASE_URL'), '@assetBasePath' => getenv('ASSET_BASE_PATH'), '@baseUrl' => getenv('PRIMARY_SITE_URL'), '@web' => getenv('PRIMARY_SITE_URL'), '@basePath' => getenv('BASE_PATH'), '@systemEmail' => getenv('SYSTEM_EMAIL'), '@recaptchaKey' => getenv('RECAPTCHA_KEY'), '@recaptchaSecretKey' => getenv('RECAPTCHA_SECRET_KEY'), '@gtagKey' => getenv('GTAG_KEY'), '@lazyloadPlaceholder'=> "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", ]);

Steps to reproduce
  1. Enter a wrong password in /admin (I'm guessing this is a server issue, in the requirements overview everything is checked)
Expected behavior

Return the error that either the username or password is invalid

Actual behavior

Returning an undefined error.

Craft CMS version

4.5.6.1

PHP version

8.1.22

Operating system and version

No response

Database type and version

mysqlnd 8.1.22

Image driver and version

No response

Installed plugins and versions

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the wrong-password login at the configured custom admin trigger, prodelta-admin, using Craft CMS 4.5.6.1 and PHP 8.1.22, then trace where the undefined error is produced. Done means invalid credentials consistently return a clear username-or-password error instead of an undefined error.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
authentication
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.