/** * Request password reset. * * @access public * @since 2.0.0 */ public function passwordRequest() { Gdn::locale()->setTranslation('Email', t(UserModel::signinLabelCode())); if ($this->Form->isPostBack() === true) { $this->Form->validateRule('Email', 'ValidateRequired'); if ($this->Form->errorCount() == 0) { try { $Email = $this->Form->getFormValue('Email'); if (!$this->UserModel->passwordRequest($Email)) { $this->Form->setValidationResults($this->UserModel->validationResults()); Logger::event('password_reset_failure', Logger::INFO, 'Can\'t find account associated with email/username {Input}.', array('Input' => $Email)); } } catch (Exception $ex) { $this->Form->addError($ex->getMessage()); } if ($this->Form->errorCount() == 0) { $this->Form->addError('Success!'); $this->View = 'passwordrequestsent'; Logger::event('password_reset_request', Logger::INFO, '{Input} has been sent a password reset email.', array('Input' => $Email)); } } else { if ($this->Form->errorCount() == 0) { $this->Form->addError("Couldn't find an account associated with that email/username."); Logger::event('password_reset_failure', Logger::INFO, 'Can\'t find account associated with email/username {Input}.', array('Input' => $this->Form->getValue('Email'))); } } } $this->render(); }