|
10 | 10 |
|
11 | 11 | namespace Joomla\Component\Users\Site\Controller; |
12 | 12 |
|
13 | | -use Joomla\CMS\Component\ComponentHelper; |
14 | 13 | use Joomla\CMS\MVC\Controller\BaseController; |
15 | | -use Joomla\CMS\Router\Route; |
16 | 14 |
|
17 | 15 | // phpcs:disable PSR1.Files.SideEffects |
18 | 16 | \defined('_JEXEC') or die; |
@@ -50,61 +48,11 @@ public function display($cachable = false, $urlparams = false) |
50 | 48 | if ($view = $this->getView($vName, $vFormat)) { |
51 | 49 | // Do any specific processing by view. |
52 | 50 | switch ($vName) { |
53 | | - case 'registration': |
54 | | - // If the user is already logged in, redirect to the profile page. |
55 | | - $user = $this->app->getIdentity(); |
56 | | - |
57 | | - if ($user->guest != 1) { |
58 | | - // Redirect to profile page. |
59 | | - $this->setRedirect(Route::_('index.php?option=com_users&view=profile', false)); |
60 | | - |
61 | | - return; |
62 | | - } |
63 | | - |
64 | | - // Check if user registration is enabled |
65 | | - if (ComponentHelper::getParams('com_users')->get('allowUserRegistration') == 0) { |
66 | | - // Registration is disabled - Redirect to login page. |
67 | | - $this->setRedirect(Route::_('index.php?option=com_users&view=login', false)); |
68 | | - |
69 | | - return; |
70 | | - } |
71 | | - |
72 | | - // The user is a guest, load the registration model and show the registration page. |
73 | | - $model = $this->getModel('Registration'); |
74 | | - break; |
75 | | - |
76 | | - case 'profile': |
77 | | - // Handle view specific models. |
78 | | - // If the user is a guest, redirect to the login page. |
79 | | - $user = $this->app->getIdentity(); |
80 | | - |
81 | | - if ($user->guest == 1) { |
82 | | - // Redirect to login page. |
83 | | - $this->setRedirect(Route::_('index.php?option=com_users&view=login', false)); |
84 | | - |
85 | | - return; |
86 | | - } |
87 | | - |
88 | | - $model = $this->getModel($vName); |
89 | | - break; |
90 | | - |
91 | | - case 'login': |
92 | | - // Handle the default views. |
93 | | - $model = $this->getModel($vName); |
94 | | - break; |
95 | | - |
96 | 51 | case 'remind': |
97 | 52 | case 'reset': |
98 | | - // If the user is already logged in, redirect to the profile page. |
99 | | - $user = $this->app->getIdentity(); |
100 | | - |
101 | | - if ($user->guest != 1) { |
102 | | - // Redirect to profile page. |
103 | | - $this->setRedirect(Route::_('index.php?option=com_users&view=profile', false)); |
104 | | - |
105 | | - return; |
106 | | - } |
107 | | - |
| 53 | + case 'registration': |
| 54 | + case 'login': |
| 55 | + case 'profile': |
108 | 56 | $model = $this->getModel($vName); |
109 | 57 | break; |
110 | 58 |
|
|
0 commit comments