Skip to content
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

Bug: resendTokenValidation wrong email template #652

Closed
lssosa opened this issue Feb 7, 2018 · 0 comments
Closed

Bug: resendTokenValidation wrong email template #652

lssosa opened this issue Feb 7, 2018 · 0 comments

Comments

@lssosa
Copy link

lssosa commented Feb 7, 2018

First of all i apologize for my bad english.

When I try to forward the validation email, the reset password template arrives in my box, then, when reviewing the source code, I find the following:

File: users/src/Controller/Traits/UserValidationTrait.php:91

if ($this->getUsersTable()->resetToken($reference, [
     'expiration' => Configure::read('Users.Token.expiration'),
     'checkActive' => true,
     'sendEmail' => true,
     'emailTemplate' => 'CakeDC/Users.validation'
])) {
    $this->Flash->success(__d(
        'CakeDC/Users',
        'Token has been reset successfully. Please check your email.'
    ));
} else {
    $this->Flash->error(__d('CakeDC/Users', 'Token could not be reset'));
}

The emailTemplate parameter with the value CakeDC/Users.validation does not take effect, look the function resetToken() in file users/src/Model/Behavior/PasswordBehavior.php:42. This function call sendResetPasswordEmail() at end without emailTemplate parameter.

protected function sendResetPasswordEmail($user)
{
    $this
        ->getMailer(Configure::read('Users.Email.mailerClass') ?: 'CakeDC/Users.Users')
        ->send('resetPassword', [$user]);
}

After change the value of the function send() from resetPassword to validation this work fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants