/** * Send the reset password email to the user * * @param EntityInterface $user User entity * @param string $template 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('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); }