fix: handle IDLE timeout

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
pull/53306/head
Ferdinand Thiessen 2025-05-27 13:00:51 +07:00
parent 177599276c
commit 15b6be55cd
No known key found for this signature in database
GPG Key ID: 45FAE7268762B400
3 changed files with 26 additions and 1 deletions

@ -42,6 +42,7 @@ use OCA\OAuth2\Db\ClientMapper;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\Attribute\UseSession;
use OCP\AppFramework\Http\Response;
use OCP\AppFramework\Http\StandaloneTemplateResponse;
@ -232,6 +233,7 @@ class ClientFlowLoginController extends Controller {
* @return Http\RedirectResponse|Response
*/
#[UseSession]
#[PasswordConfirmationRequired]
public function generateAppPassword(string $stateToken,
string $clientIdentifier = '') {
if (!$this->isValidToken($stateToken)) {

@ -34,6 +34,7 @@ use OCA\Core\ResponseDefinitions;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\OpenAPI;
use OCP\AppFramework\Http\Attribute\PasswordConfirmationRequired;
use OCP\AppFramework\Http\Attribute\UseSession;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\RedirectResponse;
@ -238,6 +239,7 @@ class ClientFlowLoginV2Controller extends Controller {
* @NoAdminRequired
*/
#[UseSession]
#[PasswordConfirmationRequired]
public function generateAppPassword(?string $stateToken): Response {
if ($stateToken === null) {
return $this->stateTokenMissingResponse();

@ -1,8 +1,29 @@
document.querySelector('form').addEventListener('submit', function(e) {
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
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')