{"record":{"id":"38af105bb0100f76","repo":"nextcloud/all-in-one","slug":"please-provide-a-valid-email-address","errorCode":null,"errorMessage":"Please provide a valid email address.","messagePattern":"Please provide a valid email address\\.","errorType":"validation","errorClass":"\\Exception","httpStatus":422,"severity":"warning","filePath":"php/src/Desec/DesecManager.php","lineNumber":160,"sourceCode":"        $this->configurationManager->desecEmail    = $validatedEmail;\n        $this->configurationManager->commitTransaction();\n\n        // This is not an error: the account was requested successfully and we now wait for\n        // the user to verify their email. Signal it with an empty token so register() can\n        // stop cleanly and the caller can re-render the awaiting-verification UI (which\n        // already explains the next step) instead of surfacing an error toast.\n        return ['', true];\n    }\n\n    /**\n     * Validates an email address string.\n     *\n     * @throws \\Exception if the email is empty or syntactically invalid\n     */\n    private function validateEmail(string $email): string {\n        $email = trim($email);\n        if ($email === '' || filter_var($email, FILTER_VALIDATE_EMAIL) === false) {\n            throw new \\Exception('Please provide a valid email address.');\n        }\n        return $email;\n    }\n\n    /**\n     * Validates an optional subdomain slug.\n     * Returns an empty string when the caller wants a randomly generated slug.\n     *\n     * @throws \\Exception if the slug is non-empty but does not match the allowed pattern\n     */\n    private function validateSlug(string $slug): string {\n        $slug = trim($slug);\n        if ($slug !== '' && !preg_match(self::SLUG_PATTERN, $slug)) {\n            throw new \\Exception(\n                'The desired subdomain must contain only lowercase letters, digits and hyphens, '\n                . 'be between 1 and 63 characters long, and must not start or end with a hyphen.'\n            );\n        }","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/nextcloud/all-in-one/blob/6b788eec5e61733cf03ed380a3572e43ae3f11ce/php/src/Desec/DesecManager.php#L142-L178","documentation":"Thrown by DesecManager::validateEmail when the trimmed email is empty or fails PHP's FILTER_VALIDATE_EMAIL. The email is the deSEC account identity used for login and verification links, so a syntactically invalid address is rejected before any API call is made.","triggerScenarios":"Calling register() with an empty email, an email missing '@' or TLD ('user@localhost', 'user@@example.com'), or one with surrounding characters that fail the filter; the address is trimmed before validation so whitespace-only input is treated as empty.","commonSituations":"Form automation sending placeholder values; users entering the deSEC subdomain into the email field; addresses with unusual-but-valid new TLDs occasionally failing older FILTER_VALIDATE_EMAIL behavior before PHP 8.0; trailing punctuation from copy-paste.","solutions":["Provide a standard, fully qualified address like 'user@example.com'.","Trim whitespace client-side before submitting.","If using an exotic address that PHP rejects, register the deSEC account manually in the browser and choose a different domain-connection method in AIO."],"exampleFix":"// before\n$email = 'not-an-email';\n\n// after\n$email = 'admin@example.com';\nif (filter_var($email, FILTER_VALIDATE_EMAIL) === false) { /* fix input */ }","handlingStrategy":"validation","validationCode":"$email = trim($email);\nif ($email === '' || filter_var($email, FILTER_VALIDATE_EMAIL) === false) {\n    // reject before calling register()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use <input type=\"email\"> plus server-side filter_var mirroring the library check.","Trim pasted input to remove stray whitespace."],"tags":["php","nextcloud-aio","desec","email-validation","input-validation","dns"],"backgroundTag":"invalid-email-format","analyzedSha":"6b788eec5e61733cf03ed380a3572e43ae3f11ce","analyzedAt":"2026-08-21T05:47:24.382Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}