+ //No route matched
+ } catch (ResourceNotFoundException $e) {
+ //Unset default path, name and route
+ unset($failurePath, $name, $route);
+ }
+ //With route name
+ } else {
+ //Try with login path route
+ try {
+ //Retrieve route matching path
+ $url = $this->router->generate($failurePath/*, $extra*/);
+
+ //Return redirect to url response
+ return new RedirectResponse($url, 302);
+ //Route not found, missing parameter or invalid parameter
+ } catch (RouteNotFoundException|MissingMandatoryParametersException|InvalidParameterException $e) {
+ //Unset default path and url
+ unset($failurePath, $url);
+ }
+ }
+ }
+ //With not enabled user
+ } elseif ($parent instanceof DisabledException) {
+ //Add error message account is not enabled
+ $this->addFlash('error', $this->translator->trans('Account not enabled', [], $this->alias));
+
+ //Redirect on the same route with sent=1 to cleanup form
+ return new RedirectResponse($this->router->generate($request->get('_route'), $request->get('_route_params')), 302);
+ //With not activated user
+ } elseif ($parent instanceof UnactivatedException) {
+ //Set user
+ $user = $parent->getUser();
+
+ //Set context
+ $context = [
+ 'recipient_mail' => $user->getMail(),
+ 'recipient_name' => $user->getRecipientName()
+ ] + array_replace_recursive(
+ $this->config['context'],
+ $this->config['register']['view']['context'],
+ $this->config['register']['mail']['context']
+ );
+
+ //Generate each route route
+ foreach($this->config['register']['route'] as $route => $tag) {
+ //Only process defined routes
+ if (!empty($this->config['route'][$route])) {
+ //Process for confirm url
+ if ($route == 'confirm') {
+ //Set the url in context
+ $context[$tag] = $this->router->generate(
+ $this->config['route'][$route]['name'],
+ //Prepend confirm context with tag
+ [
+ 'mail' => $smail = $this->slugger->short($context['recipient_mail']),
+ 'hash' => $this->slugger->hash($smail)
+ ]+$this->config['route'][$route]['context'],
+ UrlGeneratorInterface::ABSOLUTE_URL
+ );