Spaces:
Sleeping
Sleeping
Update templates/password-strength.html
Browse files- templates/password-strength.html +19 -21
templates/password-strength.html
CHANGED
|
@@ -9,17 +9,22 @@
|
|
| 9 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 10 |
|
| 11 |
<style>
|
| 12 |
-
/* ========== الأنماط
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
body {
|
| 14 |
font-family: 'Cairo', sans-serif;
|
| 15 |
-
background-color: #0b132b;
|
| 16 |
color: #ffffff;
|
| 17 |
line-height: 1.6;
|
| 18 |
-
display: flex;
|
| 19 |
-
justify-content: center;
|
| 20 |
-
align-items: center;
|
| 21 |
min-height: 100vh;
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
direction: rtl;
|
| 24 |
}
|
| 25 |
|
|
@@ -31,16 +36,16 @@
|
|
| 31 |
width: 100%;
|
| 32 |
max-width: 500px;
|
| 33 |
border: 1px solid #2a3a5a;
|
|
|
|
| 34 |
}
|
| 35 |
|
| 36 |
h1 {
|
| 37 |
font-size: 28px;
|
| 38 |
-
color: #00aaff;
|
| 39 |
border-bottom: 2px solid #00aaff;
|
| 40 |
padding-bottom: 10px;
|
| 41 |
margin-bottom: 30px;
|
| 42 |
text-align: center;
|
| 43 |
-
display: block;
|
| 44 |
}
|
| 45 |
|
| 46 |
label {
|
|
@@ -50,7 +55,6 @@
|
|
| 50 |
margin-bottom: 8px;
|
| 51 |
}
|
| 52 |
|
| 53 |
-
/* حقل الإدخال وزر الإظهار/الإخفاء */
|
| 54 |
.password-input-wrapper { position: relative; margin-bottom: 25px; }
|
| 55 |
input[type="password"], input[type="text"] {
|
| 56 |
width: 100%;
|
|
@@ -87,9 +91,9 @@
|
|
| 87 |
.result { padding: 18px; border-radius: 8px; margin-top: 25px; font-size: 1.1em; font-weight: bold; display: none; }
|
| 88 |
.result p { margin-bottom: 5px; }
|
| 89 |
|
| 90 |
-
.red { background-color: #2a0f12; color: #ff6b6b; border: 1px solid #a33232; }
|
| 91 |
-
.orange { background-color: #3b2a0f; color: #ffc36b; border: 1px solid #a37232; }
|
| 92 |
-
.green { background-color: #122a0f; color: #6bff6b; border: 1px solid #32a332; }
|
| 93 |
|
| 94 |
/* شريط التقدم */
|
| 95 |
.progress-bar-container {
|
|
@@ -150,17 +154,17 @@
|
|
| 150 |
</div>
|
| 151 |
|
| 152 |
<script>
|
| 153 |
-
//
|
| 154 |
function togglePasswordVisibility() {
|
| 155 |
const passwordInput = document.getElementById('password_input');
|
| 156 |
const toggleIcon = document.getElementById('toggle_btn').querySelector('i');
|
| 157 |
|
| 158 |
if (passwordInput.type === 'password') {
|
| 159 |
passwordInput.type = 'text';
|
| 160 |
-
toggleIcon.className = 'fas fa-eye-slash';
|
| 161 |
} else {
|
| 162 |
passwordInput.type = 'password';
|
| 163 |
-
toggleIcon.className = 'fas fa-eye';
|
| 164 |
}
|
| 165 |
}
|
| 166 |
|
|
@@ -168,7 +172,6 @@
|
|
| 168 |
const progressBar = document.getElementById('progress_bar');
|
| 169 |
progressBar.style.width = `${percentage}%`;
|
| 170 |
|
| 171 |
-
// تحديث لون الشريط
|
| 172 |
progressBar.className = 'progress-bar';
|
| 173 |
if (color === 'red') {
|
| 174 |
progressBar.classList.add('red-bar');
|
|
@@ -178,7 +181,6 @@
|
|
| 178 |
progressBar.classList.add('green-bar');
|
| 179 |
}
|
| 180 |
|
| 181 |
-
// عرض النسبة داخل الشريط
|
| 182 |
progressBar.textContent = percentage > 20 ? `${percentage}%` : '';
|
| 183 |
}
|
| 184 |
|
|
@@ -192,7 +194,6 @@
|
|
| 192 |
return;
|
| 193 |
}
|
| 194 |
|
| 195 |
-
// إرسال طلب POST إلى الخادم
|
| 196 |
fetch('/check', {
|
| 197 |
method: 'POST',
|
| 198 |
headers: { 'Content-Type': 'application/json' },
|
|
@@ -204,14 +205,11 @@
|
|
| 204 |
resultBox.className = `result ${data.color}`;
|
| 205 |
document.getElementById('password_status').textContent = data.status;
|
| 206 |
|
| 207 |
-
// تحديث النسبة المئوية
|
| 208 |
const percentage = data.percentage || 0;
|
| 209 |
document.getElementById('protection_percentage').textContent = `${percentage}%`;
|
| 210 |
|
| 211 |
-
// تحديث شريط التقدم
|
| 212 |
updateProgressBar(percentage, data.color);
|
| 213 |
|
| 214 |
-
// تحديث النصائح (باستخدام innerHTML للتعامل مع تنسيقات zxcvbn)
|
| 215 |
const feedbackDetails = document.getElementById('feedback_details');
|
| 216 |
feedbackDetails.innerHTML = '';
|
| 217 |
data.feedback.forEach(item => {
|
|
|
|
| 9 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 10 |
|
| 11 |
<style>
|
| 12 |
+
/* ========== الأنماط المُصححة (تسمح بالتمرير) ========== */
|
| 13 |
+
* {
|
| 14 |
+
margin: 0;
|
| 15 |
+
padding: 0;
|
| 16 |
+
box-sizing: border-box;
|
| 17 |
+
}
|
| 18 |
+
|
| 19 |
body {
|
| 20 |
font-family: 'Cairo', sans-serif;
|
| 21 |
+
background-color: #0b132b;
|
| 22 |
color: #ffffff;
|
| 23 |
line-height: 1.6;
|
|
|
|
|
|
|
|
|
|
| 24 |
min-height: 100vh;
|
| 25 |
+
/* تم تعديل هذا الجزء للسماح بالتمرير */
|
| 26 |
+
padding-top: 50px;
|
| 27 |
+
padding-bottom: 50px;
|
| 28 |
direction: rtl;
|
| 29 |
}
|
| 30 |
|
|
|
|
| 36 |
width: 100%;
|
| 37 |
max-width: 500px;
|
| 38 |
border: 1px solid #2a3a5a;
|
| 39 |
+
margin: 0 auto; /* هذا يضمن توسيط الحاوية */
|
| 40 |
}
|
| 41 |
|
| 42 |
h1 {
|
| 43 |
font-size: 28px;
|
| 44 |
+
color: #00aaff;
|
| 45 |
border-bottom: 2px solid #00aaff;
|
| 46 |
padding-bottom: 10px;
|
| 47 |
margin-bottom: 30px;
|
| 48 |
text-align: center;
|
|
|
|
| 49 |
}
|
| 50 |
|
| 51 |
label {
|
|
|
|
| 55 |
margin-bottom: 8px;
|
| 56 |
}
|
| 57 |
|
|
|
|
| 58 |
.password-input-wrapper { position: relative; margin-bottom: 25px; }
|
| 59 |
input[type="password"], input[type="text"] {
|
| 60 |
width: 100%;
|
|
|
|
| 91 |
.result { padding: 18px; border-radius: 8px; margin-top: 25px; font-size: 1.1em; font-weight: bold; display: none; }
|
| 92 |
.result p { margin-bottom: 5px; }
|
| 93 |
|
| 94 |
+
.red { background-color: #2a0f12; color: #ff6b6b; border: 1px solid #a33232; }
|
| 95 |
+
.orange { background-color: #3b2a0f; color: #ffc36b; border: 1px solid #a37232; }
|
| 96 |
+
.green { background-color: #122a0f; color: #6bff6b; border: 1px solid #32a332; }
|
| 97 |
|
| 98 |
/* شريط التقدم */
|
| 99 |
.progress-bar-container {
|
|
|
|
| 154 |
</div>
|
| 155 |
|
| 156 |
<script>
|
| 157 |
+
// ... (باقي كود JavaScript لم يتغير)
|
| 158 |
function togglePasswordVisibility() {
|
| 159 |
const passwordInput = document.getElementById('password_input');
|
| 160 |
const toggleIcon = document.getElementById('toggle_btn').querySelector('i');
|
| 161 |
|
| 162 |
if (passwordInput.type === 'password') {
|
| 163 |
passwordInput.type = 'text';
|
| 164 |
+
toggleIcon.className = 'fas fa-eye-slash';
|
| 165 |
} else {
|
| 166 |
passwordInput.type = 'password';
|
| 167 |
+
toggleIcon.className = 'fas fa-eye';
|
| 168 |
}
|
| 169 |
}
|
| 170 |
|
|
|
|
| 172 |
const progressBar = document.getElementById('progress_bar');
|
| 173 |
progressBar.style.width = `${percentage}%`;
|
| 174 |
|
|
|
|
| 175 |
progressBar.className = 'progress-bar';
|
| 176 |
if (color === 'red') {
|
| 177 |
progressBar.classList.add('red-bar');
|
|
|
|
| 181 |
progressBar.classList.add('green-bar');
|
| 182 |
}
|
| 183 |
|
|
|
|
| 184 |
progressBar.textContent = percentage > 20 ? `${percentage}%` : '';
|
| 185 |
}
|
| 186 |
|
|
|
|
| 194 |
return;
|
| 195 |
}
|
| 196 |
|
|
|
|
| 197 |
fetch('/check', {
|
| 198 |
method: 'POST',
|
| 199 |
headers: { 'Content-Type': 'application/json' },
|
|
|
|
| 205 |
resultBox.className = `result ${data.color}`;
|
| 206 |
document.getElementById('password_status').textContent = data.status;
|
| 207 |
|
|
|
|
| 208 |
const percentage = data.percentage || 0;
|
| 209 |
document.getElementById('protection_percentage').textContent = `${percentage}%`;
|
| 210 |
|
|
|
|
| 211 |
updateProgressBar(percentage, data.color);
|
| 212 |
|
|
|
|
| 213 |
const feedbackDetails = document.getElementById('feedback_details');
|
| 214 |
feedbackDetails.innerHTML = '';
|
| 215 |
data.feedback.forEach(item => {
|