Skip to content

Commit 94d8a53

Browse files
committed
Merge branch '5.2-dev' into 5.3-dev-upmerge-2024-12-21
2 parents f257ff6 + e74c6ac commit 94d8a53

File tree

16 files changed

+149
-34
lines changed

16 files changed

+149
-34
lines changed

administrator/components/com_joomlaupdate/src/Model/UpdateModel.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -891,10 +891,6 @@ public function cleanUp()
891891

892892
$app = Factory::getApplication();
893893

894-
// Trigger event after joomla update.
895-
// @TODO: The event dispatched twice, here and at the end of current method. One of it should be removed.
896-
$app->getDispatcher()->dispatch('onJoomlaAfterUpdate', new AfterJoomlaUpdateEvent('onJoomlaAfterUpdate'));
897-
898894
// Remove the update package.
899895
$tempdir = $app->get('tmp_path');
900896

libraries/src/Application/AdministratorApplication.php

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,17 @@ protected function doExecute()
189189
* $this->input->getCmd('option'); or $this->input->getCmd('view');
190190
* ex: due of the sef urls
191191
*/
192-
$this->checkUserRequireReset('com_users', 'user', 'edit', 'com_users/user.edit,com_users/user.save,com_users/user.apply,com_login/logout');
192+
$this->checkUserRequiresReset('com_users', 'user', 'edit', [
193+
['option' => 'com_users', 'task' => 'user.edit'],
194+
['option' => 'com_users', 'task' => 'user.save'],
195+
['option' => 'com_users', 'task' => 'user.apply'],
196+
['option' => 'com_users', 'view' => 'captivate'],
197+
['option' => 'com_login', 'task' => 'logout'],
198+
['option' => 'com_users', 'view' => 'methods'],
199+
['option' => 'com_users', 'view' => 'method'],
200+
['option' => 'com_users', 'task' => 'method.add'],
201+
['option' => 'com_users', 'task' => 'method.save'],
202+
]);
193203

194204
// Dispatch the application
195205
$this->dispatch();
@@ -359,6 +369,21 @@ public function login($credentials, $options = [])
359369

360370
$this->bootComponent('messages')->getMVCFactory()
361371
->createModel('Messages', 'Administrator')->purge($this->getIdentity() ? $this->getIdentity()->id : 0);
372+
373+
if ($result) {
374+
// Check if the user is required to reset their password
375+
$this->checkUserRequiresReset('com_users', 'user', 'edit', [
376+
['option' => 'com_users', 'task' => 'user.edit'],
377+
['option' => 'com_users', 'task' => 'user.save'],
378+
['option' => 'com_users', 'task' => 'user.apply'],
379+
['option' => 'com_users', 'view' => 'captivate'],
380+
['option' => 'com_login', 'task' => 'logout'],
381+
['option' => 'com_users', 'view' => 'methods'],
382+
['option' => 'com_users', 'view' => 'method'],
383+
['option' => 'com_users', 'task' => 'method.add'],
384+
['option' => 'com_users', 'task' => 'method.save'],
385+
]);
386+
}
362387
}
363388

364389
return $result;

libraries/src/Application/CMSApplication.php

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -365,8 +365,46 @@ public function execute()
365365
* @return void
366366
*
367367
* @throws \Exception
368+
* @deprecated __DEPLOY_VERSION__ will be removed in 7.0
369+
* Use $this->checkUserRequiresReset() instead.
368370
*/
369371
protected function checkUserRequireReset($option, $view, $layout, $tasks)
372+
{
373+
$name = $this->getName();
374+
$urls = [];
375+
376+
if ($this->get($name . '_reset_password_override', 0)) {
377+
$tasks = $this->get($name . '_reset_password_tasks', '');
378+
}
379+
380+
// Check task
381+
if (!empty($tasks)) {
382+
$tasks = explode(',', $tasks);
383+
384+
foreach ($tasks as $task) {
385+
[$option, $t] = explode('/', $task);
386+
$urls[] = ['option' => $option, 'task' => $t];
387+
}
388+
}
389+
390+
$this->checkUserRequiresReset($option, $view, $layout, $urls);
391+
}
392+
393+
/**
394+
* Check if the user is required to reset their password.
395+
*
396+
* If the user is required to reset their password will be redirected to the page that manage the password reset.
397+
*
398+
* @param string $option The option that manage the password reset
399+
* @param string $view The view that manage the password reset
400+
* @param string $layout The layout of the view that manage the password reset
401+
* @param array $urls Multi-dimensional array of permitted urls. Ex: [['option' => 'com_users', 'view' => 'profile'],...]
402+
*
403+
* @return void
404+
*
405+
* @throws \Exception
406+
*/
407+
protected function checkUserRequiresReset($option, $view, $layout, $urls = [])
370408
{
371409
if ($this->getIdentity()->requireReset) {
372410
$redirect = false;
@@ -383,23 +421,34 @@ protected function checkUserRequireReset($option, $view, $layout, $tasks)
383421
$option = $this->get($name . '_reset_password_option', '');
384422
$view = $this->get($name . '_reset_password_view', '');
385423
$layout = $this->get($name . '_reset_password_layout', '');
386-
$tasks = $this->get($name . '_reset_password_tasks', '');
424+
$urls = $this->get($name . '_reset_password_urls', $urls);
387425
}
388426

389-
$task = $this->input->getCmd('task', '');
427+
// If the current URL matches an entry in $urls, we do not redirect
428+
if (\count($urls)) {
429+
$found = false;
430+
431+
foreach ($urls as $url) {
432+
$found2 = false;
390433

391-
// Check task or option/view/layout
392-
if (!empty($task)) {
393-
$tasks = explode(',', $tasks);
434+
foreach ($url as $key => $value) {
435+
if ($this->input->getCmd($key) !== $value) {
436+
$found2 = false;
437+
break;
438+
}
439+
440+
$found2 = true;
441+
}
394442

395-
// Check full task version "option/task"
396-
if (array_search($this->input->getCmd('option', '') . '/' . $task, $tasks) === false) {
397-
// Check short task version, must be on the same option of the view
398-
if ($this->input->getCmd('option', '') !== $option || array_search($task, $tasks) === false) {
399-
// Not permitted task
400-
$redirect = true;
443+
if ($found2) {
444+
$found = true;
445+
break;
401446
}
402447
}
448+
449+
if (!$found) {
450+
$redirect = true;
451+
}
403452
} else {
404453
if (
405454
$this->input->getCmd('option', '') !== $option || $this->input->getCmd('view', '') !== $view

libraries/src/Application/SiteApplication.php

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,19 @@ protected function doExecute()
253253
* $this->input->getCmd('option'); or $this->input->getCmd('view');
254254
* ex: due of the sef urls
255255
*/
256-
$this->checkUserRequireReset('com_users', 'profile', 'edit', 'com_users/profile.save,com_users/profile.apply,com_users/user.logout');
256+
$this->checkUserRequiresReset('com_users', 'profile', 'edit', [
257+
['option' => 'com_users', 'task' => 'profile.save'],
258+
['option' => 'com_users', 'task' => 'profile.apply'],
259+
['option' => 'com_users', 'task' => 'user.logout'],
260+
['option' => 'com_users', 'task' => 'user.menulogout'],
261+
['option' => 'com_users', 'task' => 'captive.validate'],
262+
['option' => 'com_users', 'view' => 'captive'],
263+
['option' => 'com_users', 'view' => 'methods'],
264+
['option' => 'com_users', 'view' => 'method'],
265+
['option' => 'com_users', 'task' => 'method.add'],
266+
['option' => 'com_users', 'task' => 'method.save'],
267+
['option' => 'com_users', 'view' => 'profile', 'layout' => 'edit'],
268+
]);
257269
}
258270

259271
// Dispatch the application
@@ -664,7 +676,26 @@ public function login($credentials, $options = [])
664676
// Set the access control action to check.
665677
$options['action'] = 'core.login.site';
666678

667-
return parent::login($credentials, $options);
679+
$result = parent::login($credentials, $options);
680+
681+
if (!($result instanceof \Exception) && $result) {
682+
// Check if the user is required to reset their password
683+
$this->checkUserRequiresReset('com_users', 'profile', 'edit', [
684+
['option' => 'com_users', 'task' => 'profile.save'],
685+
['option' => 'com_users', 'task' => 'profile.apply'],
686+
['option' => 'com_users', 'task' => 'user.logout'],
687+
['option' => 'com_users', 'task' => 'user.menulogout'],
688+
['option' => 'com_users', 'task' => 'captive.validate'],
689+
['option' => 'com_users', 'view' => 'captive'],
690+
['option' => 'com_users', 'view' => 'methods'],
691+
['option' => 'com_users', 'view' => 'method'],
692+
['option' => 'com_users', 'task' => 'method.add'],
693+
['option' => 'com_users', 'task' => 'method.save'],
694+
['option' => 'com_users', 'view' => 'profile', 'layout' => 'edit'],
695+
]);
696+
}
697+
698+
return $result;
668699
}
669700

670701
/**

libraries/src/Console/ExtensionRemoveCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ protected function doExecute(InputInterface $input, OutputInterface $output): in
175175

176176
$response = $this->ioStyle->ask('Are you sure you want to remove this extension?', 'yes/no');
177177

178-
if (strtolower($response) === 'yes') {
178+
if ((strtolower($response) === 'yes') || $input->getOption('no-interaction')) {
179179
// Get an installer object for the extension type
180180
$installer = Installer::getInstance();
181181
$row = new Extension($this->getDatabase());

libraries/src/Installer/Adapter/ComponentAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ public function refreshManifestCache()
13601360
$manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
13611361
$this->parent->extension->manifest_cache = json_encode($manifest_details);
13621362
$this->parent->extension->name = $manifest_details['name'];
1363+
$this->parent->extension->changelogurl = $manifest_details['changelogurl'];
13631364

13641365
// Namespace is optional
13651366
if (isset($manifest_details['namespace'])) {

libraries/src/Installer/Adapter/FileAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ public function refreshManifestCache()
585585
$manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
586586
$this->parent->extension->manifest_cache = json_encode($manifest_details);
587587
$this->parent->extension->name = $manifest_details['name'];
588+
$this->parent->extension->changelogurl = $manifest_details['changelogurl'];
588589

589590
try {
590591
return $this->parent->extension->store();

libraries/src/Installer/Adapter/LanguageAdapter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,9 +734,11 @@ public function refreshManifestCache()
734734

735735
$this->parent->manifest = $this->parent->isManifest($manifestPath);
736736
$this->parent->setPath('manifest', $manifestPath);
737+
737738
$manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
738739
$this->parent->extension->manifest_cache = json_encode($manifest_details);
739740
$this->parent->extension->name = $manifest_details['name'];
741+
$this->parent->extension->changelogurl = $manifest_details['changelogurl'];
740742

741743
if ($this->parent->extension->store()) {
742744
return true;

libraries/src/Installer/Adapter/LibraryAdapter.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,7 @@ public function refreshManifestCache()
494494
$manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
495495
$this->parent->extension->manifest_cache = json_encode($manifest_details);
496496
$this->parent->extension->name = $manifest_details['name'];
497+
$this->parent->extension->changelogurl = $manifest_details['changelogurl'];
497498

498499
try {
499500
return $this->parent->extension->store();

libraries/src/Installer/Adapter/ModuleAdapter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,11 @@ public function refreshManifestCache()
415415
$manifestPath = $client->path . '/modules/' . $this->parent->extension->element . '/' . $this->parent->extension->element . '.xml';
416416
$this->parent->manifest = $this->parent->isManifest($manifestPath);
417417
$this->parent->setPath('manifest', $manifestPath);
418+
418419
$manifest_details = Installer::parseXMLInstallFile($this->parent->getPath('manifest'));
419420
$this->parent->extension->manifest_cache = json_encode($manifest_details);
420421
$this->parent->extension->name = $manifest_details['name'];
422+
$this->parent->extension->changelogurl = $manifest_details['changelogurl'];
421423

422424
if ($this->parent->extension->store()) {
423425
return true;

0 commit comments

Comments
 (0)