Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
With two domains set up, and a user's 'Domain Access' field set to only one of them, that user is still able to use the login form on both domains.
Is this a feature that's not yet implemented on D8, or was it simply never a feature of this module?
(And if it was never a feature of this module, would you be interested in a submodule implementing it, or prefer it as a separate contrib module?)
Comments
Comment #2
guilhomHello joachim,
I had the same problem with my Drupal site running Domain Access and the only solution I found was to alter the user_login form and add a new validation function to check if the assigned domains for the current user matches the current domain.
I don't know if there was a better solution, but that one worked for me.
Appreciate if someone comes with a more elegant solution.
Comment #3
Renee S CreditAttribution: Renee S commented(nmd)
Comment #4
agentrickardIt's a feature not yet implemented, though I don't believe this specific feature was ever in the main module suite.
We generally don't do much with logins, as the restrictions are hard to enforce. If you can define what the behavior should be for registering new users, it could be developed as a new module.
Comment #5
joachim CreditAttribution: joachim at Torchbox commented> If you can define what the behavior should be for registering new users, it could be developed as a new module.
Do you mean that if users can freely register new accounts, then restricting login is pointless?
Given that, I think the thing to do would be that this new module would need to warn site admins that there's no point in restricting login to a given domain unless account creation is restricted either globally, or on that domain using domain_config.
Comment #6
agentrickardThat is my concern, yes. There are multiple ways to assign domains on account creation, and handling that would have to be part of the feature definition.
Comment #7
agentrickard