/**
  * @param Request $request
  * @param array $routeParams
  * @return \Illuminate\Contracts\View\View
  */
 public function render(Request $request, array $routeParams = [])
 {
     $token = array_get($routeParams, 'token');
     $token = PasswordToken::findOrFail($token);
     if ($token->created_at < new DateTime('-1 day')) {
         throw new InvalidConfirmationTokenException();
     }
     return $this->view->make('flarum::reset')->with('token', $token->id);
 }
 /**
  * @param Request $request
  * @param array $routeParams
  * @return \Zend\Diactoros\Response\RedirectResponse
  */
 public function handle(Request $request, array $routeParams = [])
 {
     $input = $request->getParsedBody();
     $token = PasswordToken::findOrFail(array_get($input, 'token'));
     $password = array_get($input, 'password');
     $confirmation = array_get($input, 'password_confirmation');
     if (!$password || $password !== $confirmation) {
         return $this->redirectTo('/reset/' . $token->id);
         // TODO: Use UrlGenerator
     }
     $token->user->changePassword($password);
     $token->user->save();
     $token->delete();
     return $this->redirectTo('/');
 }