change api

This commit is contained in:
LathanDevers
2026-07-16 14:51:57 +02:00
parent 074e3ab195
commit 15213bba21
9 changed files with 403 additions and 24 deletions
+6 -6
View File
@@ -1,6 +1,6 @@
import { useState } from 'react';
import { useNavigate, Link } from 'react-router-dom';
import { registerUnifiedClient } from '../../services/api';
import { createNewClient } from '../../services/billing_api';
import NotificationModal from '../../components/ui/NotificationModal';
export default function Register() {
@@ -10,7 +10,7 @@ export default function Register() {
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [confirmPassword, setConfirmPassword] = useState('');
const [loading, setLoading] = useState(false);
const [customAlert, setCustomAlert] = useState(null);
const navigate = useNavigate();
@@ -28,15 +28,15 @@ export default function Register() {
setCustomAlert({ type: 'error', title: 'Erreur de saisie', message: "Les clés d'accès ne correspondent pas." });
return;
}
if (!/^[a-zA-Z0-9]{3,12}$/.test(username)) {
if (!/^[a-zA-Z0-9]{3,20}$/.test(username)) {
setCustomAlert({ type: 'error', title: 'Identifiant invalide', message: "Le nom d'utilisateur doit contenir uniquement des lettres ou chiffres (entre 3 et 12 caractères)." });
return;
}
setLoading(true);
try {
await registerUnifiedClient(email, username, password, firstName, lastName);
setCustomAlert({ type: 'success', title: 'PROVISIONNEMENT RÉUSSI', message: "Vos comptes FOSSBilling, HestiaCP et Nextcloud ont été initialisés.\n\nVous pouvez maintenant vous connecter." });
await createNewClient(email, firstName, lastName, password, confirmPassword, "individual", username);
setCustomAlert({ type: 'success', title: 'PROVISIONNEMENT RÉUSSI', message: "Votre compte a été initialisé.\n\nVous pouvez maintenant vous connecter." });
} catch (err) {
setCustomAlert({ type: 'error', title: 'Échec du Déploiement', message: err.message || "Échec de l'initialisation." });
} finally {
@@ -56,7 +56,7 @@ export default function Register() {
Créer un accès réseau
</h2>
<p className="text-[#888] font-mono text-sm mb-6">
[ INITIALISATION DU PROVISIONNEMENT TRIPLE ]
[ INITIALISATION DU PROVISIONNEMENT ]
</p>
<form onSubmit={handleRegister} className="font-mono">