Skip to content

fix token mail not working with custom Controller config + fix tests failing with latest cake #1126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 8, 2025

Conversation

LordSimal
Copy link
Contributor

If someone configures their instance to use a custom controller and table class like so in their config/users.php

'table' => 'AlfredStaffMembers.StaffMembers',
'controller' => 'AlfredStaffMembers.StaffMembers',

the mail for a one time login URL doesn't work since it was hardcoded to use the UsersController, therefore causing a Router exception.

Basically (as far as I can see) there should never be 'controller' => 'Users', anywhere in the src directory of this plugin, since all the Urls should be generated via the UsersUrl Utility to make sure it respects the users config.

Also latest cake requires rule names to be unique, therefore I just adjusted the already existing ones to make the CI green again.

@@ -197,8 +197,7 @@ public function getRegisterValidators($options)
$validateEmail = $options['validate_email'] ?? null;
$useTos = $options['use_tos'] ?? null;

$validator = $this->_table->validationDefault(new Validator());
$validator = $this->_table->validationRegister($validator);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This caused problems because the default validation rules would be loaded twice.

@LordSimal
Copy link
Contributor Author

@steinkel @ajibarra

@steinkel steinkel merged commit 1f17911 into CakeDC:15.next-cake5 Apr 8, 2025
13 checks passed
@steinkel
Copy link
Member

steinkel commented Apr 8, 2025

thank you @LordSimal !

@LordSimal
Copy link
Contributor Author

Any plans on doing a release for this? 😁

@steinkel
Copy link
Member

on it now :)

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