Skip to content

[5.x]: Logging in to the Control Panel through an alternate domain shows a warning, even for users logging in through the primary domain #16396

@MoritzLost

Description

@MoritzLost

What happened?

Description

We have a multi-site that powers two different domains. As per the single domain condition and the license enforcement guidelines, authors are instructed to only log into the Control Panel through the primary domain. However, some authors will occasionally log in through the alternate domain (when they're viewing the alternate site, it's natural to append /admin to the domain as normal). This shows a warning at the top of the Control Panel about the license being tied to a different domain, as expected. That's also a nice nudge for authors to remember to log in through the primary domain.

This problem is that this warning and/or the license check is cached and then also shown to authors that correctly log in through the primary domain. This results in this incomprehensible (and also very funny) warning:

Image

Clearing all caches will remove this warning. Maybe the cache needs to include the current domain in the cache key?

Steps to reproduce

  1. Create a multi-site with two different domains, both of which are subject to license enforcement, and add a valid license tied to one of the domains.
  2. Log out of the admin account, clear all caches through the CLI, then log in by visiting the Control Panel through the secondary domain that doesn't match the licensed domain.
  3. Wait until the error about the CMS license is displayed at the top.
  4. Open the Control Panel through the primary domain and log in again.

Expected behavior

The warning about the license not matching the domain should only be displayed if the current URL actually does not match the licensed domain.

Actual behavior

The warning may be displayed for users logging in through the correct and licensed domain.

Craft CMS version

5.4.8

PHP version

8.3

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions