]> Raphaël G. Git Repositories - userbundle/commitdiff
Improve disabled 403 status code response
authorRaphaël Gertz <git@rapsys.eu>
Sat, 28 Aug 2021 03:14:24 +0000 (05:14 +0200)
committerRaphaël Gertz <git@rapsys.eu>
Sat, 28 Aug 2021 03:14:24 +0000 (05:14 +0200)
Cleanup

Controller/DefaultController.php

index c8bb8a54886c148196bef5ed69681740dba4914b..7f6b02e0c755b2196a2b4a96bb42ff650c55067b 100644 (file)
@@ -609,18 +609,21 @@ class DefaultController extends AbstractController {
                                        //With disabled existing
                                        if ($existing->isDisabled()) {
                                                //Render view
                                        //With disabled existing
                                        if ($existing->isDisabled()) {
                                                //Render view
-                                               return $this->render(
+                                               $response = $this->render(
                                                        //Template
                                                        $this->config['register']['view']['name'],
                                                        //Context
                                                        //Template
                                                        $this->config['register']['view']['name'],
                                                        //Context
-                                                       ['title' => $this->translator->trans('Access denied'), 'disabled' => 1]+$this->config['register']['view']['context'],
-                                                       //Set 403
-                                                       new Response('', 403)
+                                                       ['title' => $this->translator->trans('Access denied'), 'disabled' => 1]+$this->config['register']['view']['context']
                                                );
                                                );
+
+                                               //Set 403
+                                               $response->setStatusCode(403);
+
+                                               //Return response
+                                               return $response;
                                        //With unactivated existing
                                        } elseif (!$existing->isActivated()) {
                                                //Set mail shortcut
                                        //With unactivated existing
                                        } elseif (!$existing->isActivated()) {
                                                //Set mail shortcut
-                                               //TODO: change for activate ???
                                                $activateMail =& $this->config['register']['mail'];
 
                                                //Generate each route route
                                                $activateMail =& $this->config['register']['mail'];
 
                                                //Generate each route route