protected resetPassword ( Cake\Datasource\EntityInterface $user, string $template = 'CakeDC/Users.reset_password' ) : array | ||
$user | Cake\Datasource\EntityInterface | User entity |
$template | string | string, note the first_name of the user will be prepended if exists |
return | array | email send result |
protected function resetPassword(EntityInterface $user, $template = 'CakeDC/Users.reset_password')
{
$firstName = isset($user['first_name']) ? $user['first_name'] . ', ' : '';
$subject = __d('CakeDC/Users', '{0}Your reset password link', $firstName);
$user->hiddenProperties(['password', 'token_expires', 'api_token']);
$this->to($user['email'])->subject($subject)->viewVars($user->toArray())->template($template);
}