feat: show deSEC password field only after email-already-registered failure, via POST /containers and Twig (no sessions, no query params)

Agent-Logs-Url: https://github.com/nextcloud/all-in-one/sessions/9eadc186-a642-409b-871d-f2bbb47f20ce

Co-authored-by: szaimen <42591237+szaimen@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-26 16:36:06 +00:00
committed by GitHub
parent 2b78dcc9cc
commit 44b257a2b5
4 changed files with 69 additions and 12 deletions

View File

@@ -0,0 +1,17 @@
<?php
declare(strict_types=1);
namespace AIO\Desec;
/**
* Thrown when the deSEC API reports that the supplied email address is already
* associated with an existing account (HTTP 400 with an "email" error field).
*/
class AlreadyRegisteredException extends \Exception {
public function __construct(string $email) {
parent::__construct(
'This email address is already registered at deSEC. '
. 'If this is your account, please enter your deSEC password in the password field and try again.',
);
}
}

View File

@@ -122,10 +122,7 @@ class DesecManager {
if ($code === 400) {
$data = json_decode($body, true, 512, JSON_THROW_ON_ERROR);
if (is_array($data) && isset($data['email'])) {
throw new \Exception(
'This email address is already registered at deSEC. '
. 'If this is your account, please enter your deSEC password in the password field and try again.',
);
throw new AlreadyRegisteredException($email);
}
throw new \Exception('Registration at deSEC failed (HTTP 400): ' . $body);
}