From a53fa690348af669cd4a143007923d2a362f5473 Mon Sep 17 00:00:00 2001 From: yoannmultigaming Date: Mon, 23 Nov 2026 16:07:24 +0100 Subject: [PATCH] =?UTF-8?q?AP=20manageur=20V1.2=20(B=C3=AAta)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 135 +++++++++++++++++++++++++++++++++++++++++++++++++- lang/en-gb.js | 7 +++ lang/en-us.js | 7 +++ lang/fr.js | 7 +++ version.json | 4 +- 5 files changed, 156 insertions(+), 4 deletions(-) diff --git a/index.html b/index.html index 673df7d..7fd45e7 100644 --- a/index.html +++ b/index.html @@ -3387,7 +3387,7 @@ -
+
+ + -
+
+
@@ -7859,6 +7881,13 @@ } } + if (typeof updatePasswordStrengthIndicator === 'function') { + try { + updatePasswordStrengthIndicator('new'); + updatePasswordStrengthIndicator('confirm'); + } catch (_) { } + } + // La sauvegarde en base de données se fait exclusivement via le bouton 'Enregistrer la personnalisation' } @@ -13551,6 +13580,107 @@ ${vpnBadgeTopo} twoFaCurrInput.addEventListener('input', () => { authCurrInput.value = twoFaCurrInput.value; }); } + function evaluatePasswordStrength(pwd) { + if (!pwd) return null; + const len = pwd.length; + const hasLower = /[a-z]/.test(pwd); + const hasUpper = /[A-Z]/.test(pwd); + const hasDigit = /[0-9]/.test(pwd); + const hasSpecial = /[^a-zA-Z0-9]/.test(pwd); + + let score = 0; + if (len >= 8) score++; + if (len >= 12) score++; + if (hasLower && hasUpper) score++; + if (hasDigit) score++; + if (hasSpecial) score++; + + if (len < 8 || score <= 1) { + return { + tier: 'weak', + label: t('pwd_strength_weak', 'Faible'), + percent: 25, + color: 'var(--red, #ef4444)' + }; + } else if (score === 2) { + return { + tier: 'fair', + label: t('pwd_strength_fair', 'Passable'), + percent: 50, + color: '#f59e0b' + }; + } else if (score === 3 || score === 4) { + return { + tier: 'strong', + label: t('pwd_strength_strong', 'Fort'), + percent: 75, + color: 'var(--green, #10b981)' + }; + } else { + return { + tier: 'extreme', + label: t('pwd_strength_extreme', 'Extrême'), + percent: 100, + color: '#8b5cf6' + }; + } + } + + function updatePasswordStrengthIndicator(type) { + const isConfirm = (type === 'confirm'); + const input = isConfirm ? $('authSettingsPasswordConfirm') : $('authSettingsPassword'); + const wrap = isConfirm ? $('pwdStrengthWrap_confirm') : $('pwdStrengthWrap_new'); + const bar = isConfirm ? $('pwdStrengthBar_confirm') : $('pwdStrengthBar_new'); + const text = isConfirm ? $('pwdStrengthText_confirm') : $('pwdStrengthText_new'); + const matchText = isConfirm ? $('pwdMatchText_confirm') : null; + + if (!input || !wrap || !bar || !text) return; + const val = input.value; + if (!val) { + wrap.style.display = 'none'; + bar.style.width = '0%'; + text.textContent = ''; + if (matchText) matchText.textContent = ''; + return; + } + + wrap.style.display = 'block'; + const res = evaluatePasswordStrength(val); + bar.style.width = res.percent + '%'; + bar.style.backgroundColor = res.color; + text.textContent = res.label; + text.style.color = res.color; + + if (isConfirm && matchText) { + const mainVal = $('authSettingsPassword') ? $('authSettingsPassword').value : ''; + if (mainVal) { + if (val === mainVal) { + matchText.textContent = t('pwd_match_yes', '✓ Identique'); + matchText.style.color = 'var(--green, #10b981)'; + } else { + matchText.textContent = t('pwd_match_no', '⚠️ Différent'); + matchText.style.color = 'var(--red, #ef4444)'; + } + } else { + matchText.textContent = ''; + } + } + } + + if ($('authSettingsPassword')) { + $('authSettingsPassword').addEventListener('input', () => { + updatePasswordStrengthIndicator('new'); + if ($('authSettingsPasswordConfirm') && $('authSettingsPasswordConfirm').value) { + updatePasswordStrengthIndicator('confirm'); + } + }); + } + if ($('authSettingsPasswordConfirm')) { + $('authSettingsPasswordConfirm').addEventListener('input', () => { + updatePasswordStrengthIndicator('confirm'); + }); + } + $('apControl').onclick = () => controlAp(status.active ? 'stop' : 'start'); $('apRestart').onclick = () => { if (status && status.active) controlAp('restart'); }; @@ -13843,6 +13973,7 @@ ${vpnBadgeTopo} const data = await response.json(); if (!response.ok) throw Error(data.error || 'Modification refusée'); message.textContent = tMsg(data.message || t('auth_creds_updated_success', 'Identifiants modifiés avec succès !')); $('authCurrentPassword').value = ''; $('authSettingsPassword').value = ''; $('authSettingsPasswordConfirm').value = ''; + updatePasswordStrengthIndicator('new'); updatePasswordStrengthIndicator('confirm'); if (typeof loadAdminUser === 'function') await loadAdminUser(); } catch (e) { message.textContent = tErr(e.message); } }); diff --git a/lang/en-gb.js b/lang/en-gb.js index 5f648db..3bcae84 100644 --- a/lang/en-gb.js +++ b/lang/en-gb.js @@ -1266,6 +1266,13 @@ window.I18N['en-gb'] = { "modal_remote_drive_title": "Remote storage files (Drive)", "btn_refresh_drive": "Refresh drive", "btn_delete_all_remote_drive": "Delete all", + "pwd_strength_label": "Password strength:", + "pwd_strength_weak": "Weak", + "pwd_strength_fair": "Fair", + "pwd_strength_strong": "Strong", + "pwd_strength_extreme": "Extreme", + "pwd_match_yes": "✓ Matching", + "pwd_match_no": "⚠️ Mismatch", "remote_drive_loading": "Connecting and retrieving files from drive…", "remote_drive_empty": "No backup files found on remote storage.", "backup_confirm_remote_delete": "Permanently delete backup \"{file}\" from remote storage (Drive)?\n\nWarning, this action cannot be undone.", diff --git a/lang/en-us.js b/lang/en-us.js index a4d0ff0..f790c86 100644 --- a/lang/en-us.js +++ b/lang/en-us.js @@ -1266,6 +1266,13 @@ window.I18N['en-us'] = { "modal_remote_drive_title": "Remote storage files (Drive)", "btn_refresh_drive": "Refresh drive", "btn_delete_all_remote_drive": "Delete all", + "pwd_strength_label": "Password strength:", + "pwd_strength_weak": "Weak", + "pwd_strength_fair": "Fair", + "pwd_strength_strong": "Strong", + "pwd_strength_extreme": "Extreme", + "pwd_match_yes": "✓ Matching", + "pwd_match_no": "⚠️ Mismatch", "remote_drive_loading": "Connecting and retrieving files from drive…", "remote_drive_empty": "No backup files found on remote storage.", "backup_confirm_remote_delete": "Permanently delete backup \"{file}\" from remote storage (Drive)?\n\nWarning, this action cannot be undone.", diff --git a/lang/fr.js b/lang/fr.js index 35f8f3b..7fe6d0f 100644 --- a/lang/fr.js +++ b/lang/fr.js @@ -1266,6 +1266,13 @@ window.I18N['fr'] = { "modal_remote_drive_title": "Fichiers du stockage distant (Drive)", "btn_refresh_drive": "Actualiser le drive", "btn_delete_all_remote_drive": "Tout supprimer", + "pwd_strength_label": "Force du mot de passe :", + "pwd_strength_weak": "Faible", + "pwd_strength_fair": "Passable", + "pwd_strength_strong": "Fort", + "pwd_strength_extreme": "Extrême", + "pwd_match_yes": "✓ Identique", + "pwd_match_no": "⚠️ Différent", "remote_drive_loading": "Connexion et récupération des fichiers sur le drive…", "remote_drive_empty": "Aucun fichier de sauvegarde trouvé sur le stockage distant.", "backup_confirm_remote_delete": "Supprimer définitivement la sauvegarde « {file} » du stockage distant (Drive) ?\n\nAttention, cette action est irréversible.", diff --git a/version.json b/version.json index d304db0..a465018 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { "version": "V1.2 (Bêta)", - "commit": "188497ae7928164807007ba9f0837d529aa5527e", - "build_date": "2026-11-23T12:30:17Z" + "commit": "ff840ae03ed9362f1aeffa039ba70f6e89cef18c", + "build_date": "2026-11-23T14:36:06Z" } \ No newline at end of file