/** * Processes the password update. * * @param string|int $id * @param string|int $key * * @return \Illuminate\Http\JsonResponse|mixed */ public function postReset($id, $key) { if ($this->passwordValidator->passes()) { $user = $this->sentry->findUserById($id); if ($user->checkResetPasswordCode($key)) { if ($user->attemptResetPassword($key, $this->input('password'))) { $link = link_to_route('maintenance.login', 'login'); $this->message = "Successfully updated your password, you can now {$link}."; $this->messageType = 'success'; $this->redirect = route('maintenance.login'); } else { $this->message = 'You have already updated your password.'; $this->messageType = 'danger'; $this->redirect = route('maintenance.login'); } } else { $this->message = 'You have already reset your password.'; $this->messageType = 'danger'; $this->redirect = route('maintenance.login'); } } else { $this->errors = $this->passwordValidator->getErrors(); $this->redirect = route('maintenance.login'); } return $this->response(); }