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

Reset password email is sent when requesting a new validation email #683

Closed
jtraulle opened this issue Apr 19, 2018 · 1 comment
Closed

Comments

@jtraulle
Copy link
Contributor

The $options array passes emailTemplate key but it is not used anymore in PasswordBehavior.php since the implementation of the new Mailer/UsersMailer.php class.

if ($this->getUsersTable()->resetToken($reference, [
'expiration' => Configure::read('Users.Token.expiration'),
'checkActive' => true,
'sendEmail' => true,
'emailTemplate' => 'CakeDC/Users.validation'
])) {

$user->updateToken($expiration);
$saveResult = $this->_table->save($user);
if (Hash::get($options, 'sendEmail')) {
$this->sendResetPasswordEmail($user);

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

$subject = __d('CakeDC/Users', '{0}Your reset password link', $firstName);
// un-hide the token to be able to send it in the email content
$user->setHidden(['password', 'token_expires', 'api_token']);
$this
->to($user['email'])
->setSubject($subject)
->setViewVars($user->toArray())
->setTemplate('CakeDC/Users.resetPassword');

I'll see what I can do to propose a PR to fix this tomorrow 😉

@jtraulle
Copy link
Contributor Author

Whooops, this is a duplicates of #652

jtraulle added a commit to jtraulle/users that referenced this issue Apr 20, 2018
chokri pushed a commit to chokri/users that referenced this issue Sep 13, 2019
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

No branches or pull requests

1 participant