aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2025-05-27 13:00:51 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-06-03 13:16:09 +0000
commit931aed3968a2285145fee84283058e725fef64fe (patch)
treef3b203645aacd56007e0d90252a7fb30294f0c84
parent709fa4b7326500ebafcadf565fa37cb7c8ae3440 (diff)
downloadnextcloud-server-backport/53292/stable30.tar.gz
nextcloud-server-backport/53292/stable30.zip
fix: handle IDLE timeoutbackport/53292/stable30
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
-rw-r--r--core/Controller/ClientFlowLoginController.php2
-rw-r--r--core/Controller/ClientFlowLoginV2Controller.php2
-rw-r--r--core/js/login/grant.js19
3 files changed, 22 insertions, 1 deletions
diff --git a/core/Controller/ClientFlowLoginController.php b/core/Controller/ClientFlowLoginController.php
index 1fad89a9a68..5fe42c2f65c 100644
--- a/core/Controller/ClientFlowLoginController.php
+++ b/core/Controller/ClientFlowLoginController.php
@@ -19,6 +19,7 @@ use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\Attribute\OpenAPI;
+use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\Attribute\UseSession;
use OCP\AppFramework\Http\Response;
@@ -214,6 +215,7 @@ class ClientFlowLoginController extends Controller {
*/
#[NoAdminRequired]
#[UseSession]
+ #[PasswordConfirmationRequired(strict: false)]
#[FrontpageRoute(verb: 'POST', url: '/login/flow')]
public function generateAppPassword(string $stateToken,
string $clientIdentifier = '',
diff --git a/core/Controller/ClientFlowLoginV2Controller.php b/core/Controller/ClientFlowLoginV2Controller.php
index b21ab2def54..d6eccf047af 100644
--- a/core/Controller/ClientFlowLoginV2Controller.php
+++ b/core/Controller/ClientFlowLoginV2Controller.php
@@ -18,6 +18,7 @@ use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\AppFramework\Http\Attribute\OpenAPI;
+use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\Attribute\PublicPage;
use OCP\AppFramework\Http\Attribute\UseSession;
use OCP\AppFramework\Http\JSONResponse;
@@ -219,6 +220,7 @@ class ClientFlowLoginV2Controller extends Controller {
#[NoAdminRequired]
#[UseSession]
+ #[PasswordConfirmationRequired(strict: false)]
#[FrontpageRoute(verb: 'POST', url: '/login/v2/grant')]
public function generateAppPassword(?string $stateToken): Response {
if ($stateToken === null) {
diff --git a/core/js/login/grant.js b/core/js/login/grant.js
index a8c788397a8..c6134504421 100644
--- a/core/js/login/grant.js
+++ b/core/js/login/grant.js
@@ -2,11 +2,28 @@
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
-document.querySelector('form').addEventListener('submit', function(e) {
+
+const form = document.querySelector('form')
+form.addEventListener('submit', function(event) {
const wrapper = document.getElementById('submit-wrapper')
if (wrapper === null) {
return
}
+
+ if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
+ // stop the event
+ event.preventDefault()
+ event.stopPropagation()
+
+ // handle password confirmation
+ OC.PasswordConfirmation.requirePasswordConfirmation(function () {
+ // when password is confirmed we submit the form
+ form.submit()
+ })
+
+ return false
+ }
+
Array.from(wrapper.getElementsByClassName('icon-confirm-white')).forEach(function(el) {
el.classList.remove('icon-confirm-white')
el.classList.add(OCA.Theming && OCA.Theming.inverted ? 'icon-loading-small' : 'icon-loading-small-dark')