aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2022-10-24 11:13:33 +0200
committerGitHub <noreply@github.com>2022-10-24 11:13:33 +0200
commit6435191a6e96600db9efbad8514d6c2eff1375d1 (patch)
treeee2162fbeaeb57673c1b704f3ad2859368077a43 /apps
parent4415fca5f8e91fbec73055187bc1d9ae78f2360b (diff)
parent58a70fe0981e0c5cca22ef7942f6e428f99e6a5c (diff)
downloadnextcloud-server-6435191a6e96600db9efbad8514d6c2eff1375d1.tar.gz
nextcloud-server-6435191a6e96600db9efbad8514d6c2eff1375d1.zip
Merge pull request #34742 from nextcloud/add_well-known_changepassword
Add .well-known/changepassword handler
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/composer/autoload.php17
-rw-r--r--apps/settings/composer/composer/autoload_classmap.php1
-rw-r--r--apps/settings/composer/composer/autoload_static.php1
-rw-r--r--apps/settings/composer/composer/installed.php4
-rw-r--r--apps/settings/lib/AppInfo/Application.php2
-rw-r--r--apps/settings/lib/WellKnown/ChangePasswordHandler.php51
6 files changed, 72 insertions, 4 deletions
diff --git a/apps/settings/composer/autoload.php b/apps/settings/composer/autoload.php
index e7087dceec2..b5f54a914b7 100644
--- a/apps/settings/composer/autoload.php
+++ b/apps/settings/composer/autoload.php
@@ -3,8 +3,21 @@
// autoload.php @generated by Composer
if (PHP_VERSION_ID < 50600) {
- echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
- exit(1);
+ if (!headers_sent()) {
+ header('HTTP/1.1 500 Internal Server Error');
+ }
+ $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL;
+ if (!ini_get('display_errors')) {
+ if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
+ fwrite(STDERR, $err);
+ } elseif (!headers_sent()) {
+ echo $err;
+ }
+ }
+ trigger_error(
+ $err,
+ E_USER_ERROR
+ );
}
require_once __DIR__ . '/composer/autoload_real.php';
diff --git a/apps/settings/composer/composer/autoload_classmap.php b/apps/settings/composer/composer/autoload_classmap.php
index 6ebb4e1e067..f45aae3eb80 100644
--- a/apps/settings/composer/composer/autoload_classmap.php
+++ b/apps/settings/composer/composer/autoload_classmap.php
@@ -76,5 +76,6 @@ return array(
'OCA\\Settings\\SetupChecks\\SupportedDatabase' => $baseDir . '/../lib/SetupChecks/SupportedDatabase.php',
'OCA\\Settings\\UserMigration\\AccountMigrator' => $baseDir . '/../lib/UserMigration/AccountMigrator.php',
'OCA\\Settings\\UserMigration\\AccountMigratorException' => $baseDir . '/../lib/UserMigration/AccountMigratorException.php',
+ 'OCA\\Settings\\WellKnown\\ChangePasswordHandler' => $baseDir . '/../lib/WellKnown/ChangePasswordHandler.php',
'OCA\\Settings\\WellKnown\\SecurityTxtHandler' => $baseDir . '/../lib/WellKnown/SecurityTxtHandler.php',
);
diff --git a/apps/settings/composer/composer/autoload_static.php b/apps/settings/composer/composer/autoload_static.php
index 19858569961..f353d007bb5 100644
--- a/apps/settings/composer/composer/autoload_static.php
+++ b/apps/settings/composer/composer/autoload_static.php
@@ -91,6 +91,7 @@ class ComposerStaticInitSettings
'OCA\\Settings\\SetupChecks\\SupportedDatabase' => __DIR__ . '/..' . '/../lib/SetupChecks/SupportedDatabase.php',
'OCA\\Settings\\UserMigration\\AccountMigrator' => __DIR__ . '/..' . '/../lib/UserMigration/AccountMigrator.php',
'OCA\\Settings\\UserMigration\\AccountMigratorException' => __DIR__ . '/..' . '/../lib/UserMigration/AccountMigratorException.php',
+ 'OCA\\Settings\\WellKnown\\ChangePasswordHandler' => __DIR__ . '/..' . '/../lib/WellKnown/ChangePasswordHandler.php',
'OCA\\Settings\\WellKnown\\SecurityTxtHandler' => __DIR__ . '/..' . '/../lib/WellKnown/SecurityTxtHandler.php',
);
diff --git a/apps/settings/composer/composer/installed.php b/apps/settings/composer/composer/installed.php
index 5f83b3f2bff..392b697de87 100644
--- a/apps/settings/composer/composer/installed.php
+++ b/apps/settings/composer/composer/installed.php
@@ -3,7 +3,7 @@
'name' => '__root__',
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '144514e49e25b7b123fd535902fee97fa39fb446',
+ 'reference' => 'a66c80135de5b21d8ad48218b96a90eefde0fc7f',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
@@ -13,7 +13,7 @@
'__root__' => array(
'pretty_version' => 'dev-master',
'version' => 'dev-master',
- 'reference' => '144514e49e25b7b123fd535902fee97fa39fb446',
+ 'reference' => 'a66c80135de5b21d8ad48218b96a90eefde0fc7f',
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
diff --git a/apps/settings/lib/AppInfo/Application.php b/apps/settings/lib/AppInfo/Application.php
index 89a988621f2..8d99f7f4f86 100644
--- a/apps/settings/lib/AppInfo/Application.php
+++ b/apps/settings/lib/AppInfo/Application.php
@@ -47,6 +47,7 @@ use OCA\Settings\Middleware\SubadminMiddleware;
use OCA\Settings\Search\AppSearch;
use OCA\Settings\Search\SectionSearch;
use OCA\Settings\UserMigration\AccountMigrator;
+use OCA\Settings\WellKnown\ChangePasswordHandler;
use OCA\Settings\WellKnown\SecurityTxtHandler;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
@@ -86,6 +87,7 @@ class Application extends App implements IBootstrap {
// Register well-known handlers
$context->registerWellKnownHandler(SecurityTxtHandler::class);
+ $context->registerWellKnownHandler(ChangePasswordHandler::class);
/**
* Core class wrappers
diff --git a/apps/settings/lib/WellKnown/ChangePasswordHandler.php b/apps/settings/lib/WellKnown/ChangePasswordHandler.php
new file mode 100644
index 00000000000..11f733474e3
--- /dev/null
+++ b/apps/settings/lib/WellKnown/ChangePasswordHandler.php
@@ -0,0 +1,51 @@
+<?php
+
+declare(strict_types=1);
+
+/**
+ * @copyright 2022 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author 2022 Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+namespace OCA\Settings\WellKnown;
+
+use OCP\AppFramework\Http\RedirectResponse;
+use OCP\Http\WellKnown\GenericResponse;
+use OCP\Http\WellKnown\IHandler;
+use OCP\Http\WellKnown\IRequestContext;
+use OCP\Http\WellKnown\IResponse;
+use OCP\IURLGenerator;
+
+class ChangePasswordHandler implements IHandler {
+
+ private IURLGenerator $urlGenerator;
+
+ public function __construct(IURLGenerator $urlGenerator) {
+ $this->urlGenerator = $urlGenerator;
+ }
+
+ public function handle(string $service, IRequestContext $context, ?IResponse $previousResponse): ?IResponse {
+ if ($service !== 'change-password') {
+ return $previousResponse;
+ }
+
+ $response = new RedirectResponse($this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index', ['section' => 'security']));
+ return new GenericResponse($response);
+ }
+}