/** * Sends an email to the user with their password reset link. */ public function postRequest() { if ($this->requestResetValidator->passes()) { $user = $this->sentry->findUserByLogin($this->input('email')); if ($user) { $sent = $this->mail->send('maintenance::emails.reset-password', ['user' => $user, 'code' => $user->getResetPasswordCode()], function ($message) use($user) { $adminEmail = $this->config->get('mail.from.address'); $adminName = $this->config->get('mail.from.name'); $message->to($user->email, $user->first_name)->from($adminEmail, $adminName)->subject('Reset Your Password'); }); if ($sent) { $this->message = "We've sent you an email to reset your password."; $this->messageType = 'success'; $this->redirect = route('maintenance.login.forgot-password'); } else { $this->message = 'There was an issue trying to send your password reset request. Please try again later.'; $this->messageType = 'danger'; $this->redirect = route('maintenance.login.forgot-password'); } } else { $this->message = 'The email/username you entered does not exist, please try again'; $this->messageType = 'danger'; $this->redirect = route('maintenance.login.forgot-password'); } } else { $this->errors = $this->requestResetValidator->getErrors(); $this->redirect = route('maintenance.login.forgot-password'); } return $this->response(); }