diff --git a/setup.html b/setup.html index c58747e..d51d335 100644 --- a/setup.html +++ b/setup.html @@ -1321,23 +1321,44 @@ -
+
+ -
+
+
+ -
+
+
🔐 Sécurité renforcée : Une fois le compte créé, vous pourrez activer l'authentification à @@ -3016,6 +3058,13 @@ 'step3_pwd_ph': 'Mot de passe robuste', 'step3_pwd_confirm_label': 'Confirmation du mot de passe *', 'step3_pwd_confirm_ph': 'Ressaisissez le mot de passe', + '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', 'step3_security_note': '🔐 Sécurité renforcée : Une fois le compte créé, vous pourrez activer l\'authentification à double facteur (2FA TOTP) et enregistrer des clés Passkeys (WebAuthn / Empreinte) dans les Paramètres.', 'step4_title': 'Notifications & Alertes', @@ -3176,6 +3225,13 @@ 'step3_pwd_ph': 'Strong password', 'step3_pwd_confirm_label': 'Confirm Password *', 'step3_pwd_confirm_ph': 'Re-enter your password', + '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': '⚠️ Different', 'step3_security_note': '🔐 Enhanced Security: Once created, you can enable Two-Factor Authentication (2FA TOTP) and register Passkeys (WebAuthn / Fingerprint) in Settings.', 'step4_title': 'Notifications & Alerts', @@ -3336,6 +3392,13 @@ 'step3_pwd_ph': 'Strong password', 'step3_pwd_confirm_label': 'Confirm Password *', 'step3_pwd_confirm_ph': 'Re-enter your password', + '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': '⚠️ Different', 'step3_security_note': '🔐 Enhanced Security: Once created, you can enable Two-Factor Authentication (2FA TOTP) and register Passkeys (WebAuthn / Fingerprint) in Settings.', 'step4_title': 'Notifications & Alerts', @@ -3518,6 +3581,13 @@ if (currentStep === 6) { updateRecap(); } + + if (typeof updatePasswordStrengthIndicator === 'function') { + updatePasswordStrengthIndicator('setupWifi'); + updatePasswordStrengthIndicator('setupWifiConfirm'); + updatePasswordStrengthIndicator('setupAdmin'); + updatePasswordStrengthIndicator('setupAdminConfirm'); + } } function togglePasswordVisibility(id, btn) { @@ -3540,6 +3610,146 @@ } } + 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) { + let input, wrap, bar, text, matchText = null, mainInput = null; + let isConfirm = false; + + if (type === 'setupWifi') { + input = $('setupPassword'); + wrap = $('pwdStrengthWrap_setupWifi'); + bar = $('pwdStrengthBar_setupWifi'); + text = $('pwdStrengthText_setupWifi'); + } else if (type === 'setupWifiConfirm') { + input = $('setupPasswordConfirm'); + mainInput = $('setupPassword'); + wrap = $('pwdStrengthWrap_setupWifiConfirm'); + bar = $('pwdStrengthBar_setupWifiConfirm'); + text = $('pwdStrengthText_setupWifiConfirm'); + matchText = $('pwdMatchText_setupWifiConfirm'); + isConfirm = true; + } else if (type === 'setupAdmin') { + input = $('setupAdminPassword'); + wrap = $('pwdStrengthWrap_setupAdmin'); + bar = $('pwdStrengthBar_setupAdmin'); + text = $('pwdStrengthText_setupAdmin'); + } else if (type === 'setupAdminConfirm') { + input = $('setupAdminPasswordConfirm'); + mainInput = $('setupAdminPassword'); + wrap = $('pwdStrengthWrap_setupAdminConfirm'); + bar = $('pwdStrengthBar_setupAdminConfirm'); + text = $('pwdStrengthText_setupAdminConfirm'); + matchText = $('pwdMatchText_setupAdminConfirm'); + isConfirm = true; + } + + 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 = mainInput ? mainInput.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 = ''; + } + } + } + + function initPasswordStrengthListeners() { + if ($('setupPassword')) { + $('setupPassword').addEventListener('input', () => { + updatePasswordStrengthIndicator('setupWifi'); + if ($('setupPasswordConfirm') && $('setupPasswordConfirm').value) { + updatePasswordStrengthIndicator('setupWifiConfirm'); + } + }); + } + if ($('setupPasswordConfirm')) { + $('setupPasswordConfirm').addEventListener('input', () => { + updatePasswordStrengthIndicator('setupWifiConfirm'); + }); + } + if ($('setupAdminPassword')) { + $('setupAdminPassword').addEventListener('input', () => { + updatePasswordStrengthIndicator('setupAdmin'); + if ($('setupAdminPasswordConfirm') && $('setupAdminPasswordConfirm').value) { + updatePasswordStrengthIndicator('setupAdminConfirm'); + } + }); + } + if ($('setupAdminPasswordConfirm')) { + $('setupAdminPasswordConfirm').addEventListener('input', () => { + updatePasswordStrengthIndicator('setupAdminConfirm'); + }); + } + } + function onModeChange() { const isBridge = $('setupModeBridge') && $('setupModeBridge').checked; const bBox = $('setupBridgeBlock'); @@ -5117,6 +5327,7 @@ } async function initSetupPage() { + initPasswordStrengthListeners(); setSetupLanguage(currentLanguage); setSetupTheme(currentTheme); initStatsReportTimeSelects(); diff --git a/version.json b/version.json index 2b51cd0..c5650f8 100644 --- a/version.json +++ b/version.json @@ -1,5 +1,5 @@ { "version": "V1.2 (Bêta)", - "commit": "a53fa690348af669cd4a143007923d2a362f5473", - "build_date": "2026-11-23T15:07:25Z" + "commit": "e26c08e41d14e14971fd66a2b19f6fc4d6562f1b", + "build_date": "2026-11-23T15:21:58Z" } \ No newline at end of file