diff --git a/index.html b/index.html
index bb32726..98f58d4 100644
--- a/index.html
+++ b/index.html
@@ -23,6 +23,16 @@
+
+
+
+
+ Cochez si vous rencontrez des problèmes de connexion ou si votre session est bloquée
+
+
diff --git a/main.js b/main.js
index 571afef..7e67f58 100644
--- a/main.js
+++ b/main.js
@@ -298,6 +298,19 @@ ipcMain.handle('login-agent', async (event, credentials) => {
try {
console.log('Tentative de connexion agent:', credentials.email, 'Terminal:', credentials.terminal);
+ // Si déconnexion forcée demandée, déconnecter d'abord la session précédente
+ if (credentials.forceDisconnect) {
+ console.log('Déconnexion forcée demandée pour:', credentials.email);
+ try {
+ // Tenter la déconnexion avec le code d'accès
+ await signalRConnection.invoke('AgentLogoff', credentials.email);
+ console.log('Session précédente déconnectée avec succès');
+ } catch (logoffError) {
+ console.warn('Erreur lors de la déconnexion forcée (session peut-être déjà fermée):', logoffError.message);
+ // Continuer même si la déconnexion échoue - la session est peut-être déjà fermée
+ }
+ }
+
// Appel SignalR pour l'authentification
const result = await signalRConnection.invoke('AgentLogin',
credentials.email,
diff --git a/renderer.js b/renderer.js
index 99f2061..cf52cda 100644
--- a/renderer.js
+++ b/renderer.js
@@ -106,6 +106,7 @@ async function handleLogin(e) {
const accessCode = document.getElementById('accessCode').value;
const password = document.getElementById('password').value;
const terminal = document.getElementById('terminal').value;
+ const forceDisconnect = document.getElementById('forceDisconnect').checked;
const errorDiv = document.getElementById('loginError');
const loginBtn = document.querySelector('#loginForm button[type="submit"]');
@@ -126,7 +127,7 @@ async function handleLogin(e) {
// Désactiver le bouton pendant la connexion
loginBtn.disabled = true;
- loginBtn.textContent = 'Connexion en cours...';
+ loginBtn.textContent = forceDisconnect ? 'Déconnexion forcée et reconnexion...' : 'Connexion en cours...';
errorDiv.textContent = '';
try {
@@ -134,7 +135,8 @@ async function handleLogin(e) {
const credentials = {
email: accessCode, // Utiliser directement le code agent comme email
password: password,
- terminal: terminal
+ terminal: terminal,
+ forceDisconnect: forceDisconnect // Ajouter l'option de déconnexion forcée
};
// Appeler l'authentification SignalR
diff --git a/styles.css b/styles.css
index 5091363..9870e57 100644
--- a/styles.css
+++ b/styles.css
@@ -379,6 +379,89 @@ body {
opacity: 1;
}
+/* Checkbox de déconnexion forcée */
+.force-disconnect-container {
+ margin: 25px 0 20px 0;
+ padding: 16px;
+ background: #f8f9fa;
+ border-radius: 8px;
+ border: 1px solid #e9ecef;
+ transition: all 0.2s ease;
+}
+
+.force-disconnect-container:hover {
+ border-color: #dee2e6;
+ background: #f1f3f5;
+}
+
+.checkbox-label {
+ display: flex;
+ align-items: flex-start;
+ cursor: pointer;
+ user-select: none;
+ font-size: 14px;
+ color: #333;
+ position: relative;
+}
+
+.checkbox-label input[type="checkbox"] {
+ position: absolute;
+ opacity: 0;
+ cursor: pointer;
+ height: 0;
+ width: 0;
+}
+
+/* Checkbox personnalisée */
+.checkbox-label::before {
+ content: '';
+ display: inline-block;
+ width: 18px;
+ height: 18px;
+ margin-right: 12px;
+ margin-top: 1px;
+ border: 2px solid #dee2e6;
+ border-radius: 4px;
+ background: white;
+ transition: all 0.2s ease;
+ flex-shrink: 0;
+}
+
+/* Checkbox cochée */
+.checkbox-label input[type="checkbox"]:checked ~ ::before {
+ background: #667eea;
+ border-color: #667eea;
+}
+
+/* Icône de check */
+.checkbox-label input[type="checkbox"]:checked ~ ::after {
+ content: '';
+ position: absolute;
+ left: 6px;
+ top: 4px;
+ width: 6px;
+ height: 11px;
+ border: solid white;
+ border-width: 0 2px 2px 0;
+ transform: rotate(45deg);
+}
+
+.checkbox-label span {
+ font-weight: 600;
+ color: #495057;
+ letter-spacing: 0.3px;
+ padding-top: 1px;
+}
+
+.checkbox-hint {
+ display: block;
+ margin-top: 6px;
+ margin-left: 30px;
+ font-size: 13px;
+ color: #6c757d;
+ line-height: 1.5;
+}
+
#loginForm button {
width: 100%;
padding: 12px;
@@ -395,6 +478,11 @@ body {
background: #5a6fd8;
}
+#loginForm button:disabled {
+ background: #a8b0e8;
+ cursor: not-allowed;
+}
+
.error-message {
color: #e74c3c;
text-align: center;