Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- index.html +302 -164
index.html
CHANGED
|
@@ -4,23 +4,29 @@
|
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 7 |
-
<title>ورود و ثبت نام | نسخه
|
| 8 |
|
| 9 |
<style>
|
| 10 |
-
/* تنظیمات پایه و متغیرها */
|
| 11 |
:root {
|
| 12 |
-
--bg-
|
| 13 |
-
--
|
| 14 |
-
--
|
| 15 |
-
|
| 16 |
-
--
|
| 17 |
-
--
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
--text-muted: #94a3b8;
|
| 19 |
-
|
| 20 |
-
--
|
| 21 |
-
--
|
| 22 |
-
--
|
| 23 |
-
--radius: 12px;
|
| 24 |
}
|
| 25 |
|
| 26 |
* {
|
|
@@ -32,71 +38,108 @@
|
|
| 32 |
|
| 33 |
body {
|
| 34 |
font-family: var(--font-main);
|
| 35 |
-
background
|
|
|
|
|
|
|
| 36 |
color: var(--text-color);
|
| 37 |
min-height: 100vh;
|
| 38 |
display: flex;
|
| 39 |
justify-content: center;
|
| 40 |
align-items: center;
|
| 41 |
padding: 20px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
}
|
| 43 |
|
| 44 |
/* لینک هدر */
|
| 45 |
.header-link {
|
| 46 |
position: fixed;
|
| 47 |
-
top:
|
| 48 |
-
left:
|
| 49 |
-
color:
|
| 50 |
text-decoration: none;
|
| 51 |
-
font-size: 0.
|
| 52 |
-
background: rgba(0, 0, 0, 0.
|
| 53 |
-
|
| 54 |
-
|
|
|
|
| 55 |
z-index: 100;
|
|
|
|
|
|
|
| 56 |
}
|
| 57 |
|
| 58 |
.header-link:hover {
|
| 59 |
-
color:
|
|
|
|
|
|
|
| 60 |
}
|
| 61 |
|
| 62 |
-
/* کانتینر اصلی */
|
| 63 |
.container {
|
| 64 |
width: 100%;
|
| 65 |
-
max-width:
|
| 66 |
background: var(--card-bg);
|
| 67 |
-
border: 1px solid var(--
|
| 68 |
border-radius: var(--radius);
|
| 69 |
-
padding:
|
| 70 |
-
box-shadow: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
}
|
| 72 |
|
| 73 |
/* هدر فرم */
|
| 74 |
.form-header {
|
| 75 |
text-align: center;
|
| 76 |
-
margin-bottom:
|
| 77 |
}
|
| 78 |
|
| 79 |
.form-header h2 {
|
| 80 |
-
font-size: 1.
|
| 81 |
-
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
| 83 |
}
|
| 84 |
|
| 85 |
.form-header p {
|
| 86 |
color: var(--text-muted);
|
| 87 |
-
font-size: 0.
|
| 88 |
}
|
| 89 |
|
| 90 |
/* ورودیها */
|
| 91 |
.input-group {
|
| 92 |
-
margin-bottom:
|
|
|
|
| 93 |
}
|
| 94 |
|
| 95 |
.input-group label {
|
| 96 |
display: block;
|
| 97 |
-
margin-bottom:
|
| 98 |
color: var(--text-muted);
|
| 99 |
font-size: 0.85rem;
|
|
|
|
| 100 |
}
|
| 101 |
|
| 102 |
.input-wrapper {
|
|
@@ -105,39 +148,47 @@
|
|
| 105 |
align-items: center;
|
| 106 |
}
|
| 107 |
|
| 108 |
-
/* آیکونهای SVG داخلی */
|
| 109 |
.icon {
|
| 110 |
width: 20px;
|
| 111 |
height: 20px;
|
| 112 |
fill: currentColor;
|
|
|
|
| 113 |
}
|
| 114 |
|
| 115 |
.icon-left {
|
| 116 |
position: absolute;
|
| 117 |
-
right:
|
| 118 |
color: var(--text-muted);
|
| 119 |
pointer-events: none;
|
| 120 |
}
|
| 121 |
|
| 122 |
.input-wrapper input {
|
| 123 |
width: 100%;
|
| 124 |
-
padding:
|
| 125 |
background: var(--input-bg);
|
| 126 |
-
border: 1px solid var(--
|
| 127 |
border-radius: var(--radius);
|
| 128 |
color: var(--text-color);
|
| 129 |
font-family: var(--font-main);
|
| 130 |
-
font-size:
|
|
|
|
| 131 |
}
|
| 132 |
|
| 133 |
.input-wrapper input:focus {
|
| 134 |
-
border-color: var(--
|
|
|
|
| 135 |
outline: none;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 136 |
}
|
| 137 |
|
| 138 |
.toggle-password {
|
| 139 |
position: absolute;
|
| 140 |
-
left:
|
| 141 |
cursor: pointer;
|
| 142 |
color: var(--text-muted);
|
| 143 |
background: none;
|
|
@@ -145,80 +196,101 @@
|
|
| 145 |
padding: 0;
|
| 146 |
display: flex;
|
| 147 |
align-items: center;
|
|
|
|
| 148 |
}
|
| 149 |
|
| 150 |
.toggle-password:hover {
|
| 151 |
-
color:
|
| 152 |
}
|
| 153 |
|
| 154 |
/* کپچا */
|
| 155 |
.captcha-container {
|
| 156 |
display: flex;
|
| 157 |
align-items: center;
|
| 158 |
-
gap:
|
| 159 |
-
margin-bottom:
|
| 160 |
flex-wrap: wrap;
|
| 161 |
}
|
| 162 |
|
| 163 |
canvas {
|
| 164 |
-
background:
|
| 165 |
-
border-radius:
|
| 166 |
cursor: pointer;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 167 |
}
|
| 168 |
|
| 169 |
.refresh-btn {
|
| 170 |
-
background:
|
| 171 |
border: none;
|
| 172 |
-
color: var(--
|
| 173 |
cursor: pointer;
|
| 174 |
-
padding:
|
|
|
|
| 175 |
display: flex;
|
| 176 |
align-items: center;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
}
|
| 178 |
|
| 179 |
.captcha-container input {
|
| 180 |
flex-grow: 1;
|
| 181 |
-
padding:
|
| 182 |
-
border-radius:
|
| 183 |
-
border: 1px solid var(--
|
| 184 |
background: var(--input-bg);
|
| 185 |
color: white;
|
| 186 |
text-align: center;
|
|
|
|
|
|
|
|
|
|
| 187 |
min-width: 80px;
|
| 188 |
}
|
| 189 |
|
| 190 |
/* دکمه ارسال */
|
| 191 |
.submit-btn {
|
| 192 |
width: 100%;
|
| 193 |
-
padding:
|
| 194 |
-
background: var(--primary-
|
| 195 |
color: white;
|
| 196 |
border: none;
|
| 197 |
border-radius: var(--radius);
|
| 198 |
font-family: var(--font-main);
|
| 199 |
font-size: 1rem;
|
| 200 |
-
font-weight:
|
| 201 |
cursor: pointer;
|
| 202 |
-
transition:
|
| 203 |
display: flex;
|
| 204 |
justify-content: center;
|
| 205 |
align-items: center;
|
| 206 |
-
gap:
|
|
|
|
|
|
|
|
|
|
| 207 |
}
|
| 208 |
|
| 209 |
.submit-btn:hover {
|
| 210 |
-
|
|
|
|
| 211 |
}
|
| 212 |
|
| 213 |
-
.submit-btn:
|
| 214 |
-
|
| 215 |
-
cursor: not-allowed;
|
| 216 |
}
|
| 217 |
|
| 218 |
/* تغییر حالت */
|
| 219 |
.switch-mode {
|
| 220 |
text-align: center;
|
| 221 |
-
margin-top:
|
| 222 |
font-size: 0.9rem;
|
| 223 |
color: var(--text-muted);
|
| 224 |
}
|
|
@@ -226,59 +298,92 @@
|
|
| 226 |
.switch-mode button {
|
| 227 |
background: none;
|
| 228 |
border: none;
|
| 229 |
-
color:
|
| 230 |
cursor: pointer;
|
| 231 |
font-family: var(--font-main);
|
| 232 |
-
font-weight:
|
| 233 |
padding: 0 5px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
}
|
| 235 |
|
| 236 |
-
/* کلاسهای کمکی */
|
| 237 |
.hidden {
|
| 238 |
-
display: none
|
|
|
|
|
|
|
| 239 |
}
|
| 240 |
|
| 241 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 242 |
.toast-container {
|
| 243 |
position: fixed;
|
| 244 |
-
bottom:
|
| 245 |
-
left:
|
| 246 |
-
|
| 247 |
z-index: 1000;
|
| 248 |
display: flex;
|
| 249 |
flex-direction: column;
|
| 250 |
-
align-items:
|
| 251 |
gap: 10px;
|
|
|
|
|
|
|
| 252 |
}
|
| 253 |
|
| 254 |
.toast {
|
| 255 |
-
background:
|
| 256 |
-
border
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
|
|
|
| 260 |
color: var(--text-color);
|
| 261 |
font-size: 0.9rem;
|
| 262 |
display: flex;
|
| 263 |
align-items: center;
|
| 264 |
-
gap:
|
| 265 |
-
|
| 266 |
-
animation:
|
| 267 |
}
|
| 268 |
|
| 269 |
-
.toast.success { border-
|
| 270 |
-
.toast.error { border-
|
| 271 |
|
| 272 |
-
@keyframes
|
| 273 |
-
from { transform:
|
| 274 |
-
to { transform:
|
| 275 |
}
|
| 276 |
|
| 277 |
@media (max-width: 360px) {
|
| 278 |
-
.
|
| 279 |
-
|
| 280 |
-
flex-basis: 100%;
|
| 281 |
-
}
|
| 282 |
}
|
| 283 |
</style>
|
| 284 |
</head>
|
|
@@ -291,17 +396,16 @@
|
|
| 291 |
|
| 292 |
<div class="container">
|
| 293 |
<!-- فرم ورود -->
|
| 294 |
-
<div id="login-form">
|
| 295 |
<div class="form-header">
|
| 296 |
<h2>خوش آمدید</h2>
|
| 297 |
-
<p>وارد حساب
|
| 298 |
</div>
|
| 299 |
|
| 300 |
<form onsubmit="handleLogin(event)">
|
| 301 |
<div class="input-group">
|
| 302 |
<label>نام کاربری</label>
|
| 303 |
<div class="input-wrapper">
|
| 304 |
-
<!-- SVG Icon: User -->
|
| 305 |
<svg class="icon icon-left" viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>
|
| 306 |
<input type="text" id="login-username" placeholder="نام کاربری" autocomplete="off">
|
| 307 |
</div>
|
|
@@ -310,43 +414,39 @@
|
|
| 310 |
<div class="input-group">
|
| 311 |
<label>رمز عبور</label>
|
| 312 |
<div class="input-wrapper">
|
| 313 |
-
<!-- SVG Icon: Lock -->
|
| 314 |
<svg class="icon icon-left" viewBox="0 0 24 24"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>
|
| 315 |
<input type="password" id="login-password" placeholder="رمز عبور">
|
| 316 |
<button type="button" class="toggle-password" onclick="togglePassword('login-password', this)">
|
| 317 |
-
<!-- SVG Icon: Eye Slash -->
|
| 318 |
<svg class="icon" viewBox="0 0 24 24"><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>
|
| 319 |
</button>
|
| 320 |
</div>
|
| 321 |
</div>
|
| 322 |
|
| 323 |
<div class="captcha-container">
|
| 324 |
-
<canvas id="captchaCanvas" width="100" height="
|
| 325 |
<button type="button" class="refresh-btn" onclick="drawCaptcha()">
|
| 326 |
-
<!-- SVG Icon: Refresh -->
|
| 327 |
<svg class="icon" viewBox="0 0 24 24"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></svg>
|
| 328 |
</button>
|
| 329 |
-
<input type="text" id="login-captcha" placeholder="کد">
|
| 330 |
</div>
|
| 331 |
|
| 332 |
<button type="submit" class="submit-btn">
|
| 333 |
-
<span>ورود</span>
|
| 334 |
-
<!-- SVG Icon: Sign In -->
|
| 335 |
<svg class="icon" viewBox="0 0 24 24"><path d="M11 7L9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5-5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8v14z"/></svg>
|
| 336 |
</button>
|
| 337 |
|
| 338 |
<div class="switch-mode">
|
| 339 |
-
حساب ندارید؟
|
| 340 |
-
<button type="button" onclick="switchForm('register')">ثبت نام</button>
|
| 341 |
</div>
|
| 342 |
</form>
|
| 343 |
</div>
|
| 344 |
|
| 345 |
<!-- فرم ثبت نام -->
|
| 346 |
-
<div id="register-form" class="hidden">
|
| 347 |
<div class="form-header">
|
| 348 |
-
<h2>
|
| 349 |
-
<p>
|
| 350 |
</div>
|
| 351 |
|
| 352 |
<form onsubmit="handleRegister(event)">
|
|
@@ -370,7 +470,7 @@
|
|
| 370 |
</div>
|
| 371 |
|
| 372 |
<div class="input-group">
|
| 373 |
-
<label>تکرار رمز</label>
|
| 374 |
<div class="input-wrapper">
|
| 375 |
<svg class="icon icon-left" viewBox="0 0 24 24"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"/></svg>
|
| 376 |
<input type="password" id="reg-confirm-password" placeholder="تکرار رمز عبور">
|
|
@@ -378,21 +478,21 @@
|
|
| 378 |
</div>
|
| 379 |
|
| 380 |
<div class="captcha-container">
|
| 381 |
-
<canvas id="captchaCanvasReg" width="100" height="
|
| 382 |
<button type="button" class="refresh-btn" onclick="drawCaptcha(true)">
|
| 383 |
<svg class="icon" viewBox="0 0 24 24"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></svg>
|
| 384 |
</button>
|
| 385 |
-
<input type="text" id="reg-captcha" placeholder="کد">
|
| 386 |
</div>
|
| 387 |
|
| 388 |
<button type="submit" class="submit-btn">
|
| 389 |
-
<span>ثبت نام</span>
|
| 390 |
<svg class="icon" viewBox="0 0 24 24"><path d="M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>
|
| 391 |
</button>
|
| 392 |
|
| 393 |
<div class="switch-mode">
|
| 394 |
-
|
| 395 |
-
<button type="button" onclick="switchForm('login')">ورود</button>
|
| 396 |
</div>
|
| 397 |
</form>
|
| 398 |
</div>
|
|
@@ -414,28 +514,52 @@
|
|
| 414 |
function switchForm(type) {
|
| 415 |
const login = document.getElementById('login-form');
|
| 416 |
const reg = document.getElementById('register-form');
|
| 417 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 418 |
|
| 419 |
-
|
| 420 |
-
|
| 421 |
-
|
| 422 |
-
|
| 423 |
-
|
| 424 |
-
|
| 425 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 426 |
}
|
| 427 |
|
| 428 |
function togglePassword(id, btn) {
|
| 429 |
const input = document.getElementById(id);
|
| 430 |
-
const
|
| 431 |
|
| 432 |
-
|
| 433 |
-
|
| 434 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
btn.innerHTML = '<svg class="icon" viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>';
|
| 436 |
} else {
|
| 437 |
-
|
| 438 |
-
// Change back to Eye Slash
|
| 439 |
btn.innerHTML = '<svg class="icon" viewBox="0 0 24 24"><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>';
|
| 440 |
}
|
| 441 |
}
|
|
@@ -444,31 +568,50 @@
|
|
| 444 |
const cvs = document.getElementById(isReg ? 'captchaCanvasReg' : 'captchaCanvas');
|
| 445 |
const ctx = cvs.getContext('2d');
|
| 446 |
ctx.clearRect(0, 0, cvs.width, cvs.height);
|
| 447 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 448 |
ctx.fillRect(0, 0, cvs.width, cvs.height);
|
| 449 |
|
| 450 |
-
const chars = '
|
| 451 |
let txt = '';
|
| 452 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 453 |
|
| 454 |
if(isReg) currentCaptchaReg = txt; else currentCaptcha = txt;
|
| 455 |
|
| 456 |
-
ctx.font = 'bold
|
| 457 |
ctx.textBaseline = 'middle';
|
|
|
|
| 458 |
for(let i=0; i<5; i++) {
|
| 459 |
ctx.save();
|
| 460 |
-
ctx.translate(15 + i*
|
| 461 |
-
ctx.rotate((Math.random()-0.5)*0.
|
| 462 |
-
ctx.fillStyle =
|
| 463 |
ctx.fillText(txt[i], 0, 0);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 464 |
ctx.restore();
|
| 465 |
}
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
|
|
|
|
|
|
| 469 |
ctx.beginPath();
|
| 470 |
-
ctx.moveTo(Math.random()*100, Math.random()*
|
| 471 |
-
ctx.lineTo(Math.random()*100, Math.random()*
|
| 472 |
ctx.stroke();
|
| 473 |
}
|
| 474 |
}
|
|
@@ -477,20 +620,23 @@
|
|
| 477 |
e.preventDefault();
|
| 478 |
const u = document.getElementById('login-username').value;
|
| 479 |
const p = document.getElementById('login-password').value;
|
| 480 |
-
const c = document.getElementById('login-captcha').value;
|
| 481 |
|
| 482 |
-
if(!u || !p) return showToast('فیلدها ا
|
| 483 |
-
if(c !== currentCaptcha) return showToast('کد اشتباه است', 'error');
|
| 484 |
|
| 485 |
const btn = e.target.querySelector('.submit-btn');
|
|
|
|
| 486 |
btn.disabled = true;
|
| 487 |
-
btn.innerHTML = 'در حال
|
|
|
|
| 488 |
|
| 489 |
setTimeout(() => {
|
| 490 |
btn.disabled = false;
|
| 491 |
-
btn.innerHTML =
|
| 492 |
-
|
| 493 |
-
|
|
|
|
| 494 |
}
|
| 495 |
|
| 496 |
function handleRegister(e) {
|
|
@@ -498,40 +644,32 @@
|
|
| 498 |
const u = document.getElementById('reg-username').value;
|
| 499 |
const p = document.getElementById('reg-password').value;
|
| 500 |
const cp = document.getElementById('reg-confirm-password').value;
|
| 501 |
-
const c = document.getElementById('reg-captcha').value;
|
| 502 |
|
| 503 |
-
if(!u || !p || !cp) return showToast('فیلدها ا
|
| 504 |
-
if(p.length < 6) return showToast('رمز
|
| 505 |
-
if(p !== cp) return showToast('تکرار م
|
| 506 |
-
if(c !== currentCaptchaReg) return showToast('کد اشتباه است', 'error');
|
| 507 |
|
| 508 |
const btn = e.target.querySelector('.submit-btn');
|
|
|
|
| 509 |
btn.disabled = true;
|
| 510 |
-
btn.innerHTML = 'در حال ثبت...';
|
|
|
|
| 511 |
|
| 512 |
setTimeout(() => {
|
| 513 |
btn.disabled = false;
|
| 514 |
-
btn.innerHTML =
|
| 515 |
-
|
|
|
|
| 516 |
switchForm('login');
|
| 517 |
-
},
|
| 518 |
}
|
| 519 |
|
| 520 |
function showToast(msg, type) {
|
| 521 |
const con = document.getElementById('toastContainer');
|
| 522 |
const t = document.createElement('div');
|
| 523 |
t.className = `toast ${type}`;
|
| 524 |
-
const icon = type === 'success'
|
| 525 |
-
? '<svg class="icon" style="fill:#22c55e" viewBox="0 0 24 24"><path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/></svg>'
|
| 526 |
-
: '<svg class="icon" style="fill:#ef4444" viewBox="0 0 24 24"><path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"/></svg>';
|
| 527 |
|
| 528 |
-
|
| 529 |
-
|
| 530 |
-
setTimeout(() => {
|
| 531 |
-
t.style.opacity = '0';
|
| 532 |
-
setTimeout(() => t.remove(), 300);
|
| 533 |
-
}, 3000);
|
| 534 |
-
}
|
| 535 |
-
</script>
|
| 536 |
-
</body>
|
| 537 |
-
</html>
|
|
|
|
| 4 |
<head>
|
| 5 |
<meta charset="UTF-8">
|
| 6 |
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
| 7 |
+
<title>ورود و ثبت نام | نسخه مدرن</title>
|
| 8 |
|
| 9 |
<style>
|
| 10 |
+
/* تنظیمات پایه و متغیرهای رنگی */
|
| 11 |
:root {
|
| 12 |
+
--bg-gradient-1: #0f172a;
|
| 13 |
+
--bg-gradient-2: #1e1b4b;
|
| 14 |
+
--bg-gradient-3: #312e81;
|
| 15 |
+
|
| 16 |
+
--card-bg: rgba(30, 41, 59, 0.75);
|
| 17 |
+
--card-border: rgba(255, 255, 255, 0.1);
|
| 18 |
+
|
| 19 |
+
--input-bg: rgba(15, 23, 42, 0.6);
|
| 20 |
+
--input-border: rgba(148, 163, 184, 0.2);
|
| 21 |
+
--input-focus: #6366f1;
|
| 22 |
+
|
| 23 |
+
--primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
| 24 |
+
--text-color: #f8fafc;
|
| 25 |
--text-muted: #94a3b8;
|
| 26 |
+
|
| 27 |
+
--font-main: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
| 28 |
+
--radius: 16px;
|
| 29 |
+
--transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
|
| 30 |
}
|
| 31 |
|
| 32 |
* {
|
|
|
|
| 38 |
|
| 39 |
body {
|
| 40 |
font-family: var(--font-main);
|
| 41 |
+
background: linear-gradient(-45deg, var(--bg-gradient-1), var(--bg-gradient-2), var(--bg-gradient-3), #0f172a);
|
| 42 |
+
background-size: 400% 400%;
|
| 43 |
+
animation: gradientBG 15s ease infinite;
|
| 44 |
color: var(--text-color);
|
| 45 |
min-height: 100vh;
|
| 46 |
display: flex;
|
| 47 |
justify-content: center;
|
| 48 |
align-items: center;
|
| 49 |
padding: 20px;
|
| 50 |
+
overflow-x: hidden;
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
/* انیمیشن پسزمینه */
|
| 54 |
+
@keyframes gradientBG {
|
| 55 |
+
0% { background-position: 0% 50%; }
|
| 56 |
+
50% { background-position: 100% 50%; }
|
| 57 |
+
100% { background-position: 0% 50%; }
|
| 58 |
}
|
| 59 |
|
| 60 |
/* لینک هدر */
|
| 61 |
.header-link {
|
| 62 |
position: fixed;
|
| 63 |
+
top: 20px;
|
| 64 |
+
left: 20px;
|
| 65 |
+
color: rgba(255, 255, 255, 0.6);
|
| 66 |
text-decoration: none;
|
| 67 |
+
font-size: 0.85rem;
|
| 68 |
+
background: rgba(0, 0, 0, 0.3);
|
| 69 |
+
backdrop-filter: blur(4px);
|
| 70 |
+
padding: 8px 12px;
|
| 71 |
+
border-radius: 20px;
|
| 72 |
z-index: 100;
|
| 73 |
+
border: 1px solid rgba(255,255,255,0.05);
|
| 74 |
+
transition: var(--transition);
|
| 75 |
}
|
| 76 |
|
| 77 |
.header-link:hover {
|
| 78 |
+
color: #fff;
|
| 79 |
+
background: rgba(255, 255, 255, 0.1);
|
| 80 |
+
transform: translateY(-2px);
|
| 81 |
}
|
| 82 |
|
| 83 |
+
/* کانتینر اصلی - افکت شیشهای */
|
| 84 |
.container {
|
| 85 |
width: 100%;
|
| 86 |
+
max-width: 420px;
|
| 87 |
background: var(--card-bg);
|
| 88 |
+
border: 1px solid var(--card-border);
|
| 89 |
border-radius: var(--radius);
|
| 90 |
+
padding: 40px 30px;
|
| 91 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
| 92 |
+
backdrop-filter: blur(12px);
|
| 93 |
+
-webkit-backdrop-filter: blur(12px);
|
| 94 |
+
position: relative;
|
| 95 |
+
overflow: hidden;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
/* دکوراسیون نورانی پشت کارت */
|
| 99 |
+
.container::before {
|
| 100 |
+
content: '';
|
| 101 |
+
position: absolute;
|
| 102 |
+
top: -50%;
|
| 103 |
+
left: -50%;
|
| 104 |
+
width: 200%;
|
| 105 |
+
height: 200%;
|
| 106 |
+
background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
|
| 107 |
+
pointer-events: none;
|
| 108 |
+
z-index: -1;
|
| 109 |
}
|
| 110 |
|
| 111 |
/* هدر فرم */
|
| 112 |
.form-header {
|
| 113 |
text-align: center;
|
| 114 |
+
margin-bottom: 30px;
|
| 115 |
}
|
| 116 |
|
| 117 |
.form-header h2 {
|
| 118 |
+
font-size: 1.8rem;
|
| 119 |
+
margin-bottom: 8px;
|
| 120 |
+
background: linear-gradient(to right, #fff, #cbd5e1);
|
| 121 |
+
-webkit-background-clip: text;
|
| 122 |
+
-webkit-text-fill-color: transparent;
|
| 123 |
+
font-weight: 800;
|
| 124 |
}
|
| 125 |
|
| 126 |
.form-header p {
|
| 127 |
color: var(--text-muted);
|
| 128 |
+
font-size: 0.95rem;
|
| 129 |
}
|
| 130 |
|
| 131 |
/* ورودیها */
|
| 132 |
.input-group {
|
| 133 |
+
margin-bottom: 20px;
|
| 134 |
+
position: relative;
|
| 135 |
}
|
| 136 |
|
| 137 |
.input-group label {
|
| 138 |
display: block;
|
| 139 |
+
margin-bottom: 8px;
|
| 140 |
color: var(--text-muted);
|
| 141 |
font-size: 0.85rem;
|
| 142 |
+
font-weight: 500;
|
| 143 |
}
|
| 144 |
|
| 145 |
.input-wrapper {
|
|
|
|
| 148 |
align-items: center;
|
| 149 |
}
|
| 150 |
|
|
|
|
| 151 |
.icon {
|
| 152 |
width: 20px;
|
| 153 |
height: 20px;
|
| 154 |
fill: currentColor;
|
| 155 |
+
transition: var(--transition);
|
| 156 |
}
|
| 157 |
|
| 158 |
.icon-left {
|
| 159 |
position: absolute;
|
| 160 |
+
right: 14px;
|
| 161 |
color: var(--text-muted);
|
| 162 |
pointer-events: none;
|
| 163 |
}
|
| 164 |
|
| 165 |
.input-wrapper input {
|
| 166 |
width: 100%;
|
| 167 |
+
padding: 14px 45px 14px 14px;
|
| 168 |
background: var(--input-bg);
|
| 169 |
+
border: 1px solid var(--input-border);
|
| 170 |
border-radius: var(--radius);
|
| 171 |
color: var(--text-color);
|
| 172 |
font-family: var(--font-main);
|
| 173 |
+
font-size: 1rem;
|
| 174 |
+
transition: var(--transition);
|
| 175 |
}
|
| 176 |
|
| 177 |
.input-wrapper input:focus {
|
| 178 |
+
border-color: var(--input-focus);
|
| 179 |
+
box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
|
| 180 |
outline: none;
|
| 181 |
+
background: rgba(15, 23, 42, 0.8);
|
| 182 |
+
}
|
| 183 |
+
|
| 184 |
+
.input-wrapper:focus-within .icon-left {
|
| 185 |
+
color: var(--input-focus);
|
| 186 |
+
transform: scale(1.1);
|
| 187 |
}
|
| 188 |
|
| 189 |
.toggle-password {
|
| 190 |
position: absolute;
|
| 191 |
+
left: 14px;
|
| 192 |
cursor: pointer;
|
| 193 |
color: var(--text-muted);
|
| 194 |
background: none;
|
|
|
|
| 196 |
padding: 0;
|
| 197 |
display: flex;
|
| 198 |
align-items: center;
|
| 199 |
+
transition: var(--transition);
|
| 200 |
}
|
| 201 |
|
| 202 |
.toggle-password:hover {
|
| 203 |
+
color: #fff;
|
| 204 |
}
|
| 205 |
|
| 206 |
/* کپچا */
|
| 207 |
.captcha-container {
|
| 208 |
display: flex;
|
| 209 |
align-items: center;
|
| 210 |
+
gap: 10px;
|
| 211 |
+
margin-bottom: 25px;
|
| 212 |
flex-wrap: wrap;
|
| 213 |
}
|
| 214 |
|
| 215 |
canvas {
|
| 216 |
+
background: rgba(255, 255, 255, 0.9);
|
| 217 |
+
border-radius: 8px;
|
| 218 |
cursor: pointer;
|
| 219 |
+
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
|
| 220 |
+
transition: transform 0.2s;
|
| 221 |
+
}
|
| 222 |
+
|
| 223 |
+
canvas:active {
|
| 224 |
+
transform: scale(0.98);
|
| 225 |
}
|
| 226 |
|
| 227 |
.refresh-btn {
|
| 228 |
+
background: rgba(255, 255, 255, 0.1);
|
| 229 |
border: none;
|
| 230 |
+
color: var(--text-color);
|
| 231 |
cursor: pointer;
|
| 232 |
+
padding: 8px;
|
| 233 |
+
border-radius: 8px;
|
| 234 |
display: flex;
|
| 235 |
align-items: center;
|
| 236 |
+
justify-content: center;
|
| 237 |
+
transition: var(--transition);
|
| 238 |
+
}
|
| 239 |
+
|
| 240 |
+
.refresh-btn:hover {
|
| 241 |
+
background: rgba(255, 255, 255, 0.2);
|
| 242 |
+
transform: rotate(180deg);
|
| 243 |
}
|
| 244 |
|
| 245 |
.captcha-container input {
|
| 246 |
flex-grow: 1;
|
| 247 |
+
padding: 12px;
|
| 248 |
+
border-radius: var(--radius);
|
| 249 |
+
border: 1px solid var(--input-border);
|
| 250 |
background: var(--input-bg);
|
| 251 |
color: white;
|
| 252 |
text-align: center;
|
| 253 |
+
font-family: monospace;
|
| 254 |
+
font-size: 1.1rem;
|
| 255 |
+
letter-spacing: 2px;
|
| 256 |
min-width: 80px;
|
| 257 |
}
|
| 258 |
|
| 259 |
/* دکمه ارسال */
|
| 260 |
.submit-btn {
|
| 261 |
width: 100%;
|
| 262 |
+
padding: 14px;
|
| 263 |
+
background: var(--primary-gradient);
|
| 264 |
color: white;
|
| 265 |
border: none;
|
| 266 |
border-radius: var(--radius);
|
| 267 |
font-family: var(--font-main);
|
| 268 |
font-size: 1rem;
|
| 269 |
+
font-weight: 700;
|
| 270 |
cursor: pointer;
|
| 271 |
+
transition: var(--transition);
|
| 272 |
display: flex;
|
| 273 |
justify-content: center;
|
| 274 |
align-items: center;
|
| 275 |
+
gap: 10px;
|
| 276 |
+
box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
|
| 277 |
+
position: relative;
|
| 278 |
+
overflow: hidden;
|
| 279 |
}
|
| 280 |
|
| 281 |
.submit-btn:hover {
|
| 282 |
+
transform: translateY(-2px);
|
| 283 |
+
box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
|
| 284 |
}
|
| 285 |
|
| 286 |
+
.submit-btn:active {
|
| 287 |
+
transform: translateY(0);
|
|
|
|
| 288 |
}
|
| 289 |
|
| 290 |
/* تغییر حالت */
|
| 291 |
.switch-mode {
|
| 292 |
text-align: center;
|
| 293 |
+
margin-top: 25px;
|
| 294 |
font-size: 0.9rem;
|
| 295 |
color: var(--text-muted);
|
| 296 |
}
|
|
|
|
| 298 |
.switch-mode button {
|
| 299 |
background: none;
|
| 300 |
border: none;
|
| 301 |
+
color: #818cf8;
|
| 302 |
cursor: pointer;
|
| 303 |
font-family: var(--font-main);
|
| 304 |
+
font-weight: 700;
|
| 305 |
padding: 0 5px;
|
| 306 |
+
position: relative;
|
| 307 |
+
transition: var(--transition);
|
| 308 |
+
}
|
| 309 |
+
|
| 310 |
+
.switch-mode button::after {
|
| 311 |
+
content: '';
|
| 312 |
+
position: absolute;
|
| 313 |
+
width: 0;
|
| 314 |
+
height: 2px;
|
| 315 |
+
bottom: -2px;
|
| 316 |
+
right: 0;
|
| 317 |
+
background-color: #818cf8;
|
| 318 |
+
transition: width 0.3s;
|
| 319 |
+
}
|
| 320 |
+
|
| 321 |
+
.switch-mode button:hover::after {
|
| 322 |
+
width: 100%;
|
| 323 |
+
}
|
| 324 |
+
|
| 325 |
+
/* مدیریت نمایش فرمها (انیمیشن) */
|
| 326 |
+
.form-wrapper {
|
| 327 |
+
transition: opacity 0.4s ease, transform 0.4s ease;
|
| 328 |
}
|
| 329 |
|
|
|
|
| 330 |
.hidden {
|
| 331 |
+
display: none;
|
| 332 |
+
opacity: 0;
|
| 333 |
+
transform: translateY(10px);
|
| 334 |
}
|
| 335 |
|
| 336 |
+
.fade-in {
|
| 337 |
+
animation: fadeIn 0.5s forwards;
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
@keyframes fadeIn {
|
| 341 |
+
from { opacity: 0; transform: translateY(10px); }
|
| 342 |
+
to { opacity: 1; transform: translateY(0); }
|
| 343 |
+
}
|
| 344 |
+
|
| 345 |
+
/* Toast بهبود یافته */
|
| 346 |
.toast-container {
|
| 347 |
position: fixed;
|
| 348 |
+
bottom: 30px;
|
| 349 |
+
left: 50%;
|
| 350 |
+
transform: translateX(-50%);
|
| 351 |
z-index: 1000;
|
| 352 |
display: flex;
|
| 353 |
flex-direction: column;
|
| 354 |
+
align-items: center;
|
| 355 |
gap: 10px;
|
| 356 |
+
width: 90%;
|
| 357 |
+
max-width: 350px;
|
| 358 |
}
|
| 359 |
|
| 360 |
.toast {
|
| 361 |
+
background: rgba(30, 41, 59, 0.95);
|
| 362 |
+
border: 1px solid rgba(255,255,255,0.1);
|
| 363 |
+
backdrop-filter: blur(10px);
|
| 364 |
+
padding: 14px 20px;
|
| 365 |
+
border-radius: 12px;
|
| 366 |
+
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
|
| 367 |
color: var(--text-color);
|
| 368 |
font-size: 0.9rem;
|
| 369 |
display: flex;
|
| 370 |
align-items: center;
|
| 371 |
+
gap: 12px;
|
| 372 |
+
width: 100%;
|
| 373 |
+
animation: toastUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
| 374 |
}
|
| 375 |
|
| 376 |
+
.toast.success { border-right: 4px solid #22c55e; }
|
| 377 |
+
.toast.error { border-right: 4px solid #ef4444; }
|
| 378 |
|
| 379 |
+
@keyframes toastUp {
|
| 380 |
+
from { transform: translateY(50px); opacity: 0; }
|
| 381 |
+
to { transform: translateY(0); opacity: 1; }
|
| 382 |
}
|
| 383 |
|
| 384 |
@media (max-width: 360px) {
|
| 385 |
+
.container { padding: 30px 15px; }
|
| 386 |
+
.captcha-container input { width: 100%; flex-basis: 100%; }
|
|
|
|
|
|
|
| 387 |
}
|
| 388 |
</style>
|
| 389 |
</head>
|
|
|
|
| 396 |
|
| 397 |
<div class="container">
|
| 398 |
<!-- فرم ورود -->
|
| 399 |
+
<div id="login-form" class="form-wrapper fade-in">
|
| 400 |
<div class="form-header">
|
| 401 |
<h2>خوش آمدید</h2>
|
| 402 |
+
<p>برای ادامه وارد حساب خود شوید</p>
|
| 403 |
</div>
|
| 404 |
|
| 405 |
<form onsubmit="handleLogin(event)">
|
| 406 |
<div class="input-group">
|
| 407 |
<label>نام کاربری</label>
|
| 408 |
<div class="input-wrapper">
|
|
|
|
| 409 |
<svg class="icon icon-left" viewBox="0 0 24 24"><path d="M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>
|
| 410 |
<input type="text" id="login-username" placeholder="نام کاربری" autocomplete="off">
|
| 411 |
</div>
|
|
|
|
| 414 |
<div class="input-group">
|
| 415 |
<label>رمز عبور</label>
|
| 416 |
<div class="input-wrapper">
|
|
|
|
| 417 |
<svg class="icon icon-left" viewBox="0 0 24 24"><path d="M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2zm-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2zm3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1 1.71 0 3.1 1.39 3.1 3.1v2z"/></svg>
|
| 418 |
<input type="password" id="login-password" placeholder="رمز عبور">
|
| 419 |
<button type="button" class="toggle-password" onclick="togglePassword('login-password', this)">
|
|
|
|
| 420 |
<svg class="icon" viewBox="0 0 24 24"><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>
|
| 421 |
</button>
|
| 422 |
</div>
|
| 423 |
</div>
|
| 424 |
|
| 425 |
<div class="captcha-container">
|
| 426 |
+
<canvas id="captchaCanvas" width="100" height="42" title="کلیک برای تغییر"></canvas>
|
| 427 |
<button type="button" class="refresh-btn" onclick="drawCaptcha()">
|
|
|
|
| 428 |
<svg class="icon" viewBox="0 0 24 24"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></svg>
|
| 429 |
</button>
|
| 430 |
+
<input type="text" id="login-captcha" placeholder="کد امنیتی" maxlength="5">
|
| 431 |
</div>
|
| 432 |
|
| 433 |
<button type="submit" class="submit-btn">
|
| 434 |
+
<span>ورود به حساب</span>
|
|
|
|
| 435 |
<svg class="icon" viewBox="0 0 24 24"><path d="M11 7L9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5-5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8v14z"/></svg>
|
| 436 |
</button>
|
| 437 |
|
| 438 |
<div class="switch-mode">
|
| 439 |
+
حساب کاربری ندارید؟
|
| 440 |
+
<button type="button" onclick="switchForm('register')">ثبت نام کنید</button>
|
| 441 |
</div>
|
| 442 |
</form>
|
| 443 |
</div>
|
| 444 |
|
| 445 |
<!-- فرم ثبت نام -->
|
| 446 |
+
<div id="register-form" class="form-wrapper hidden">
|
| 447 |
<div class="form-header">
|
| 448 |
+
<h2>ایجاد حساب</h2>
|
| 449 |
+
<p>به جمع ما بپیوندید</p>
|
| 450 |
</div>
|
| 451 |
|
| 452 |
<form onsubmit="handleRegister(event)">
|
|
|
|
| 470 |
</div>
|
| 471 |
|
| 472 |
<div class="input-group">
|
| 473 |
+
<label>تکرار رمز عبور</label>
|
| 474 |
<div class="input-wrapper">
|
| 475 |
<svg class="icon icon-left" viewBox="0 0 24 24"><path d="M12 1L3 5v6c0 5.55 3.84 10.74 9 12 5.16-1.26 9-6.45 9-12V5l-9-4zm-2 16l-4-4 1.41-1.41L10 14.17l6.59-6.59L18 9l-8 8z"/></svg>
|
| 476 |
<input type="password" id="reg-confirm-password" placeholder="تکرار رمز عبور">
|
|
|
|
| 478 |
</div>
|
| 479 |
|
| 480 |
<div class="captcha-container">
|
| 481 |
+
<canvas id="captchaCanvasReg" width="100" height="42" title="کلیک برای تغییر"></canvas>
|
| 482 |
<button type="button" class="refresh-btn" onclick="drawCaptcha(true)">
|
| 483 |
<svg class="icon" viewBox="0 0 24 24"><path d="M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4l-2.35 2.35z"/></svg>
|
| 484 |
</button>
|
| 485 |
+
<input type="text" id="reg-captcha" placeholder="کد امنیتی" maxlength="5">
|
| 486 |
</div>
|
| 487 |
|
| 488 |
<button type="submit" class="submit-btn">
|
| 489 |
+
<span>ثبت نام رایگان</span>
|
| 490 |
<svg class="icon" viewBox="0 0 24 24"><path d="M15 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm-9-2V7H4v3H1v2h3v3h2v-3h3v-2H6zm9 4c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"/></svg>
|
| 491 |
</button>
|
| 492 |
|
| 493 |
<div class="switch-mode">
|
| 494 |
+
قبلاً ثبت نام کردهاید؟
|
| 495 |
+
<button type="button" onclick="switchForm('login')">وارد شوید</button>
|
| 496 |
</div>
|
| 497 |
</form>
|
| 498 |
</div>
|
|
|
|
| 514 |
function switchForm(type) {
|
| 515 |
const login = document.getElementById('login-form');
|
| 516 |
const reg = document.getElementById('register-form');
|
| 517 |
+
const activeForm = type === 'register' ? reg : login;
|
| 518 |
+
const inactiveForm = type === 'register' ? login : reg;
|
| 519 |
+
|
| 520 |
+
// انیمیشن خروجی
|
| 521 |
+
inactiveForm.style.opacity = '0';
|
| 522 |
+
inactiveForm.style.transform = 'translateY(-10px)';
|
| 523 |
|
| 524 |
+
setTimeout(() => {
|
| 525 |
+
inactiveForm.classList.add('hidden');
|
| 526 |
+
document.querySelectorAll('input').forEach(i => i.value = '');
|
| 527 |
+
|
| 528 |
+
// انیمیشن ورودی
|
| 529 |
+
inactiveForm.classList.remove('fade-in'); // ریست کردن کلاس انیمیشن
|
| 530 |
+
activeForm.classList.remove('hidden');
|
| 531 |
+
activeForm.style.opacity = '0';
|
| 532 |
+
activeForm.style.transform = 'translateY(10px)';
|
| 533 |
+
|
| 534 |
+
// Force reflow
|
| 535 |
+
void activeForm.offsetWidth;
|
| 536 |
+
|
| 537 |
+
activeForm.classList.add('fade-in');
|
| 538 |
+
activeForm.style.opacity = '1';
|
| 539 |
+
activeForm.style.transform = 'translateY(0)';
|
| 540 |
+
|
| 541 |
+
// مجددا کپچا رسم شود (اختیاری، برای امنیت بیشتر)
|
| 542 |
+
if(type === 'login') drawCaptcha();
|
| 543 |
+
else drawCaptcha(true);
|
| 544 |
+
|
| 545 |
+
}, 300); // صبر تا انیمیشن خروج تمام شود
|
| 546 |
}
|
| 547 |
|
| 548 |
function togglePassword(id, btn) {
|
| 549 |
const input = document.getElementById(id);
|
| 550 |
+
const isPassword = input.type === 'password';
|
| 551 |
|
| 552 |
+
input.type = isPassword ? 'text' : 'password';
|
| 553 |
+
|
| 554 |
+
// تغییر آیکون با چرخش
|
| 555 |
+
btn.style.transform = isPassword ? 'rotate(0deg)' : 'rotate(360deg)';
|
| 556 |
+
btn.style.transition = 'transform 0.5s ease';
|
| 557 |
+
|
| 558 |
+
if (isPassword) {
|
| 559 |
+
// چشم باز
|
| 560 |
btn.innerHTML = '<svg class="icon" viewBox="0 0 24 24"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>';
|
| 561 |
} else {
|
| 562 |
+
// چشم بسته
|
|
|
|
| 563 |
btn.innerHTML = '<svg class="icon" viewBox="0 0 24 24"><path d="M12 7c2.76 0 5 2.24 5 5 0 .65-.13 1.26-.36 1.83l2.92 2.92c1.51-1.26 2.7-2.89 3.43-4.75-1.73-4.39-6-7.5-11-7.5-1.4 0-2.74.25-3.98.7l2.16 2.16C10.74 7.13 11.35 7 12 7zM2 4.27l2.28 2.28.46.46C3.08 8.3 1.78 10.02 1 12c1.73 4.39 6 7.5 11 7.5 1.55 0 3.03-.3 4.38-.84l.42.42L19.73 22 21 20.73 3.27 3 2 4.27zM7.53 9.8l1.55 1.55c-.05.21-.08.43-.08.65 0 1.66 1.34 3 3 3 .22 0 .44-.03.65-.08l1.55 1.55c-.67.33-1.41.53-2.2.53-2.76 0-5-2.24-5-5 0-.79.2-1.53.53-2.2zm4.31-.78l3.15 3.15.02-.16c0-1.66-1.34-3-3-3l-.17.01z"/></svg>';
|
| 564 |
}
|
| 565 |
}
|
|
|
|
| 568 |
const cvs = document.getElementById(isReg ? 'captchaCanvasReg' : 'captchaCanvas');
|
| 569 |
const ctx = cvs.getContext('2d');
|
| 570 |
ctx.clearRect(0, 0, cvs.width, cvs.height);
|
| 571 |
+
|
| 572 |
+
// پس زمینه روشنتر با گرادیانت ملایم
|
| 573 |
+
const grd = ctx.createLinearGradient(0, 0, cvs.width, cvs.height);
|
| 574 |
+
grd.addColorStop(0, "#f1f5f9");
|
| 575 |
+
grd.addColorStop(1, "#e2e8f0");
|
| 576 |
+
ctx.fillStyle = grd;
|
| 577 |
ctx.fillRect(0, 0, cvs.width, cvs.height);
|
| 578 |
|
| 579 |
+
const chars = '23456789ABCDEFGHJKLMNPQRSTUVWXYZ';
|
| 580 |
let txt = '';
|
| 581 |
+
const colors = ['#ef4444', '#3b82f6', '#10b981', '#f59e0b', '#8b5cf6'];
|
| 582 |
+
|
| 583 |
+
for(let i=0; i<5; i++) {
|
| 584 |
+
txt += chars[Math.floor(Math.random()*chars.length)];
|
| 585 |
+
}
|
| 586 |
|
| 587 |
if(isReg) currentCaptchaReg = txt; else currentCaptcha = txt;
|
| 588 |
|
| 589 |
+
ctx.font = 'bold 26px Courier New';
|
| 590 |
ctx.textBaseline = 'middle';
|
| 591 |
+
|
| 592 |
for(let i=0; i<5; i++) {
|
| 593 |
ctx.save();
|
| 594 |
+
ctx.translate(15 + i*17, 22);
|
| 595 |
+
ctx.rotate((Math.random()-0.5)*0.5);
|
| 596 |
+
ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
|
| 597 |
ctx.fillText(txt[i], 0, 0);
|
| 598 |
+
|
| 599 |
+
// سایه برای حروف
|
| 600 |
+
ctx.shadowColor = "rgba(0,0,0,0.1)";
|
| 601 |
+
ctx.shadowBlur = 2;
|
| 602 |
+
ctx.shadowOffsetX = 1;
|
| 603 |
+
ctx.shadowOffsetY = 1;
|
| 604 |
+
|
| 605 |
ctx.restore();
|
| 606 |
}
|
| 607 |
+
|
| 608 |
+
// خطوط نویز
|
| 609 |
+
for(let i=0; i<7; i++) {
|
| 610 |
+
ctx.strokeStyle = 'rgba(0,0,0,0.05)';
|
| 611 |
+
ctx.lineWidth = 2;
|
| 612 |
ctx.beginPath();
|
| 613 |
+
ctx.moveTo(Math.random()*100, Math.random()*42);
|
| 614 |
+
ctx.lineTo(Math.random()*100, Math.random()*42);
|
| 615 |
ctx.stroke();
|
| 616 |
}
|
| 617 |
}
|
|
|
|
| 620 |
e.preventDefault();
|
| 621 |
const u = document.getElementById('login-username').value;
|
| 622 |
const p = document.getElementById('login-password').value;
|
| 623 |
+
const c = document.getElementById('login-captcha').value.toUpperCase();
|
| 624 |
|
| 625 |
+
if(!u || !p) return showToast('لطفاً همه فیلدها را پر کنید', 'error');
|
| 626 |
+
if(c !== currentCaptcha) return showToast('کد امنیتی اشتباه است', 'error');
|
| 627 |
|
| 628 |
const btn = e.target.querySelector('.submit-btn');
|
| 629 |
+
const originalContent = btn.innerHTML;
|
| 630 |
btn.disabled = true;
|
| 631 |
+
btn.innerHTML = '<span>در حال بررسی...</span>';
|
| 632 |
+
btn.style.opacity = '0.8';
|
| 633 |
|
| 634 |
setTimeout(() => {
|
| 635 |
btn.disabled = false;
|
| 636 |
+
btn.innerHTML = originalContent;
|
| 637 |
+
btn.style.opacity = '1';
|
| 638 |
+
showToast('ورود با موفقیت انجام شد!', 'success');
|
| 639 |
+
}, 1500);
|
| 640 |
}
|
| 641 |
|
| 642 |
function handleRegister(e) {
|
|
|
|
| 644 |
const u = document.getElementById('reg-username').value;
|
| 645 |
const p = document.getElementById('reg-password').value;
|
| 646 |
const cp = document.getElementById('reg-confirm-password').value;
|
| 647 |
+
const c = document.getElementById('reg-captcha').value.toUpperCase();
|
| 648 |
|
| 649 |
+
if(!u || !p || !cp) return showToast('لطفاً همه فیلدها را پر کنید', 'error');
|
| 650 |
+
if(p.length < 6) return showToast('رمز عبور باید حداقل ۶ کاراکتر باشد', 'error');
|
| 651 |
+
if(p !== cp) return showToast('تکرار رمز عبور مطابقت ندارد', 'error');
|
| 652 |
+
if(c !== currentCaptchaReg) return showToast('کد امنیتی اشتباه است', 'error');
|
| 653 |
|
| 654 |
const btn = e.target.querySelector('.submit-btn');
|
| 655 |
+
const originalContent = btn.innerHTML;
|
| 656 |
btn.disabled = true;
|
| 657 |
+
btn.innerHTML = '<span>در حال ثبت...</span>';
|
| 658 |
+
btn.style.opacity = '0.8';
|
| 659 |
|
| 660 |
setTimeout(() => {
|
| 661 |
btn.disabled = false;
|
| 662 |
+
btn.innerHTML = originalContent;
|
| 663 |
+
btn.style.opacity = '1';
|
| 664 |
+
showToast('حساب کاربری ایجاد شد! خوش آمدید.', 'success');
|
| 665 |
switchForm('login');
|
| 666 |
+
}, 1500);
|
| 667 |
}
|
| 668 |
|
| 669 |
function showToast(msg, type) {
|
| 670 |
const con = document.getElementById('toastContainer');
|
| 671 |
const t = document.createElement('div');
|
| 672 |
t.className = `toast ${type}`;
|
|
|
|
|
|
|
|
|
|
| 673 |
|
| 674 |
+
// آیکونهای جدیدتر
|
| 675 |
+
const
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|