/** * Process form * * @param User $entity * * @return bool True on successful processing, false otherwise */ public function process(User $entity) { if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { $this->form->submit($this->request); if ($this->form->isValid()) { $entity->setPlainPassword($this->form->get('password')->getData()); $entity->setPasswordChangedAt(new \DateTime()); try { $this->mailerProcessor->sendChangePasswordEmail($entity); } catch (\Exception $e) { $this->form->addError(new FormError($this->translator->trans('oro.email.handler.unable_to_send_email'))); $this->logger->error('Email sending failed.', ['exception' => $e]); return false; } $this->userManager->updateUser($entity); return true; } } return false; }
public function testSendResetPasswordAsAdminEmail() { $this->assertSendCalled(Processor::TEMPLATE_USER_RESET_PASSWORD_AS_ADMIN, ['entity' => $this->user], $this->buildMessage($this->user->getEmail())); $this->mailProcessor->sendResetPasswordAsAdminEmail($this->user); }