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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fa" dir="rtl">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>ورود و ثبت نام | سیستم امن</title>
|
| 7 |
+
<!-- اتصال فونت وزیرمتن برای ظاهر زیبای فارسی -->
|
| 8 |
+
<link href="https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css" rel="stylesheet" type="text/css" />
|
| 9 |
+
|
| 10 |
+
<style>
|
| 11 |
+
/* تنظیمات کلی و متغیرهای رنگی */
|
| 12 |
+
:root {
|
| 13 |
+
--bg-color: #121212;
|
| 14 |
+
--card-bg: #1e1e2e;
|
| 15 |
+
--input-bg: #2a2a3c;
|
| 16 |
+
--primary-color: #7c4dff;
|
| 17 |
+
--primary-hover: #651fff;
|
| 18 |
+
--text-color: #ffffff;
|
| 19 |
+
--text-muted: #a0a0b0;
|
| 20 |
+
--error-color: #ff5252;
|
| 21 |
+
--success-color: #00e676;
|
| 22 |
+
--border-radius: 12px;
|
| 23 |
+
--transition-speed: 0.3s;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
* {
|
| 27 |
+
box-sizing: border-box;
|
| 28 |
+
margin: 0;
|
| 29 |
+
padding: 0;
|
| 30 |
+
font-family: 'Vazirmatn', sans-serif;
|
| 31 |
+
outline: none;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
body {
|
| 35 |
+
background-color: var(--bg-color);
|
| 36 |
+
background-image: radial-gradient(circle at top left, #2a1a4a, #121212);
|
| 37 |
+
color: var(--text-color);
|
| 38 |
+
display: flex;
|
| 39 |
+
justify-content: center;
|
| 40 |
+
align-items: center;
|
| 41 |
+
min-height: 100vh;
|
| 42 |
+
overflow-x: hidden;
|
| 43 |
+
padding: 20px;
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
/* لینک هدر درخواست شده */
|
| 47 |
+
.header-link {
|
| 48 |
+
position: absolute;
|
| 49 |
+
top: 20px;
|
| 50 |
+
left: 20px;
|
| 51 |
+
color: var(--text-muted);
|
| 52 |
+
text-decoration: none;
|
| 53 |
+
font-size: 0.9rem;
|
| 54 |
+
transition: color 0.3s;
|
| 55 |
+
z-index: 100;
|
| 56 |
+
}
|
| 57 |
+
|
| 58 |
+
.header-link:hover {
|
| 59 |
+
color: var(--primary-color);
|
| 60 |
+
}
|
| 61 |
+
|
| 62 |
+
/* کانتینر اصلی کارت */
|
| 63 |
+
.container {
|
| 64 |
+
background-color: var(--card-bg);
|
| 65 |
+
border-radius: var(--border-radius);
|
| 66 |
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
|
| 67 |
+
position: relative;
|
| 68 |
+
overflow: hidden;
|
| 69 |
+
width: 100%;
|
| 70 |
+
max-width: 450px;
|
| 71 |
+
min-height: 600px;
|
| 72 |
+
}
|
| 73 |
+
|
| 74 |
+
/* جعبه فرمها */
|
| 75 |
+
.forms-wrapper {
|
| 76 |
+
position: absolute;
|
| 77 |
+
top: 0;
|
| 78 |
+
left: 0;
|
| 79 |
+
width: 100%;
|
| 80 |
+
height: 100%;
|
| 81 |
+
display: flex;
|
| 82 |
+
transition: transform var(--transition-speed) ease-in-out;
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.form-content {
|
| 86 |
+
width: 100%;
|
| 87 |
+
height: 100%;
|
| 88 |
+
padding: 40px;
|
| 89 |
+
display: flex;
|
| 90 |
+
flex-direction: column;
|
| 91 |
+
justify-content: center;
|
| 92 |
+
opacity: 0;
|
| 93 |
+
visibility: hidden;
|
| 94 |
+
transition: opacity var(--transition-speed);
|
| 95 |
+
flex-shrink: 0;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.form-content.active {
|
| 99 |
+
opacity: 1;
|
| 100 |
+
visibility: visible;
|
| 101 |
+
}
|
| 102 |
+
|
| 103 |
+
h2 {
|
| 104 |
+
font-size: 1.8rem;
|
| 105 |
+
margin-bottom: 10px;
|
| 106 |
+
color: var(--primary-color);
|
| 107 |
+
text-align: center;
|
| 108 |
+
}
|
| 109 |
+
|
| 110 |
+
p.subtitle {
|
| 111 |
+
text-align: center;
|
| 112 |
+
color: var(--text-muted);
|
| 113 |
+
margin-bottom: 30px;
|
| 114 |
+
font-size: 0.9rem;
|
| 115 |
+
}
|
| 116 |
+
|
| 117 |
+
/* استایل ورودیها */
|
| 118 |
+
.input-group {
|
| 119 |
+
margin-bottom: 20px;
|
| 120 |
+
position: relative;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.input-group label {
|
| 124 |
+
display: block;
|
| 125 |
+
margin-bottom: 8px;
|
| 126 |
+
color: var(--text-muted);
|
| 127 |
+
font-size: 0.9rem;
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
.input-wrapper {
|
| 131 |
+
position: relative;
|
| 132 |
+
}
|
| 133 |
+
|
| 134 |
+
input {
|
| 135 |
+
width: 100%;
|
| 136 |
+
padding: 12px 15px;
|
| 137 |
+
background-color: var(--input-bg);
|
| 138 |
+
border: 2px solid transparent;
|
| 139 |
+
border-radius: 8px;
|
| 140 |
+
color: var(--text-color);
|
| 141 |
+
font-size: 1rem;
|
| 142 |
+
transition: border-color 0.3s;
|
| 143 |
+
}
|
| 144 |
+
|
| 145 |
+
input:focus {
|
| 146 |
+
border-color: var(--primary-color);
|
| 147 |
+
}
|
| 148 |
+
|
| 149 |
+
/* آیکونهای داخل ورودی (با CSS خالص) */
|
| 150 |
+
.input-icon {
|
| 151 |
+
position: absolute;
|
| 152 |
+
left: 15px;
|
| 153 |
+
top: 50%;
|
| 154 |
+
transform: translateY(-50%);
|
| 155 |
+
color: var(--text-muted);
|
| 156 |
+
pointer-events: none;
|
| 157 |
+
}
|
| 158 |
+
|
| 159 |
+
/* بخش کپچا */
|
| 160 |
+
.captcha-container {
|
| 161 |
+
display: flex;
|
| 162 |
+
align-items: center;
|
| 163 |
+
gap: 10px;
|
| 164 |
+
margin-bottom: 20px;
|
| 165 |
+
background: var(--input-bg);
|
| 166 |
+
padding: 5px;
|
| 167 |
+
border-radius: 8px;
|
| 168 |
+
}
|
| 169 |
+
|
| 170 |
+
.captcha-wrapper {
|
| 171 |
+
position: relative;
|
| 172 |
+
cursor: pointer;
|
| 173 |
+
border-radius: 6px;
|
| 174 |
+
overflow: hidden;
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
canvas {
|
| 178 |
+
display: block;
|
| 179 |
+
background-color: #fff; /* پسزمینه روشن برای خوانایی کپچا */
|
| 180 |
+
}
|
| 181 |
+
|
| 182 |
+
.refresh-btn {
|
| 183 |
+
background: none;
|
| 184 |
+
border: none;
|
| 185 |
+
color: var(--primary-color);
|
| 186 |
+
cursor: pointer;
|
| 187 |
+
font-size: 1.2rem;
|
| 188 |
+
padding: 5px;
|
| 189 |
+
transition: transform 0.3s;
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
.refresh-btn:hover {
|
| 193 |
+
transform: rotate(90deg);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
input#captchaInput {
|
| 197 |
+
flex-grow: 1;
|
| 198 |
+
background: transparent;
|
| 199 |
+
border: none;
|
| 200 |
+
border-bottom: 2px solid var(--text-muted);
|
| 201 |
+
border-radius: 0;
|
| 202 |
+
padding: 10px;
|
| 203 |
+
}
|
| 204 |
+
|
| 205 |
+
input#captchaInput:focus {
|
| 206 |
+
border-bottom-color: var(--primary-color);
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
/* دکمهها */
|
| 210 |
+
.btn {
|
| 211 |
+
width: 100%;
|
| 212 |
+
padding: 14px;
|
| 213 |
+
background: linear-gradient(45deg, var(--primary-color), var(--primary-hover));
|
| 214 |
+
border: none;
|
| 215 |
+
border-radius: 8px;
|
| 216 |
+
color: white;
|
| 217 |
+
font-size: 1rem;
|
| 218 |
+
font-weight: bold;
|
| 219 |
+
cursor: pointer;
|
| 220 |
+
transition: transform 0.2s, box-shadow 0.2s;
|
| 221 |
+
margin-top: 10px;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
.btn:hover {
|
| 225 |
+
transform: translateY(-2px);
|
| 226 |
+
box-shadow: 0 5px 15px rgba(124, 77, 255, 0.4);
|
| 227 |
+
}
|
| 228 |
+
|
| 229 |
+
.btn:active {
|
| 230 |
+
transform: translateY(0);
|
| 231 |
+
}
|
| 232 |
+
|
| 233 |
+
/* لینک تغییر حالت */
|
| 234 |
+
.toggle-text {
|
| 235 |
+
text-align: center;
|
| 236 |
+
margin-top: 20px;
|
| 237 |
+
color: var(--text-muted);
|
| 238 |
+
font-size: 0.9rem;
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
.toggle-text a {
|
| 242 |
+
color: var(--primary-color);
|
| 243 |
+
text-decoration: none;
|
| 244 |
+
font-weight: bold;
|
| 245 |
+
cursor: pointer;
|
| 246 |
+
}
|
| 247 |
+
|
| 248 |
+
.toggle-text a:hover {
|
| 249 |
+
text-decoration: underline;
|
| 250 |
+
}
|
| 251 |
+
|
| 252 |
+
/* سیستم اعلان (Toast) */
|
| 253 |
+
.toast-container {
|
| 254 |
+
position: fixed;
|
| 255 |
+
top: 20px;
|
| 256 |
+
right: 20px;
|
| 257 |
+
z-index: 1000;
|
| 258 |
+
display: flex;
|
| 259 |
+
flex-direction: column;
|
| 260 |
+
gap: 10px;
|
| 261 |
+
}
|
| 262 |
+
|
| 263 |
+
.toast {
|
| 264 |
+
background: var(--card-bg);
|
| 265 |
+
color: var(--text-color);
|
| 266 |
+
padding: 15px 20px;
|
| 267 |
+
border-radius: 8px;
|
| 268 |
+
box-shadow: 0 5px 15px rgba(0,0,0,0.3);
|
| 269 |
+
display: flex;
|
| 270 |
+
align-items: center;
|
| 271 |
+
gap: 10px;
|
| 272 |
+
min-width: 250px;
|
| 273 |
+
border-right: 4px solid var(--primary-color);
|
| 274 |
+
animation: slideIn 0.3s ease-out forwards;
|
| 275 |
+
opacity: 0;
|
| 276 |
+
transform: translateX(100%);
|
| 277 |
+
}
|
| 278 |
+
|
| 279 |
+
.toast.success { border-right-color: var(--success-color); }
|
| 280 |
+
.toast.error { border-right-color: var(--error-color); }
|
| 281 |
+
|
| 282 |
+
@keyframes slideIn {
|
| 283 |
+
to { opacity: 1; transform: translateX(0); }
|
| 284 |
+
}
|
| 285 |
+
|
| 286 |
+
@keyframes fadeOut {
|
| 287 |
+
to { opacity: 0; transform: translateX(100%); }
|
| 288 |
+
}
|
| 289 |
+
|
| 290 |
+
/* مدیا کوئری برای موبایل */
|
| 291 |
+
@media (max-width: 480px) {
|
| 292 |
+
.container {
|
| 293 |
+
min-height: auto;
|
| 294 |
+
border-radius: 0;
|
| 295 |
+
box-shadow: none;
|
| 296 |
+
background: transparent;
|
| 297 |
+
}
|
| 298 |
+
body {
|
| 299 |
+
padding: 0;
|
| 300 |
+
align-items: flex-start;
|
| 301 |
+
}
|
| 302 |
+
.form-content {
|
| 303 |
+
padding: 20px;
|
| 304 |
+
background: var(--card-bg);
|
| 305 |
+
border-radius: 20px;
|
| 306 |
+
margin: 20px 0;
|
| 307 |
+
}
|
| 308 |
+
}
|
| 309 |
+
</style>
|
| 310 |
+
</head>
|
| 311 |
+
<body>
|
| 312 |
+
|
| 313 |
+
<!-- لینک هدر درخواست شده -->
|
| 314 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" target="_blank" class="header-link">
|
| 315 |
+
Built with anycoder
|
| 316 |
+
</a>
|
| 317 |
+
|
| 318 |
+
<!-- کانتینر اصلی -->
|
| 319 |
+
<div class="container">
|
| 320 |
+
<div class="forms-wrapper" id="formsWrapper">
|
| 321 |
+
|
| 322 |
+
<!-- فرم ورود -->
|
| 323 |
+
<div class="form-content active" id="loginForm">
|
| 324 |
+
<h2>ورود به حساب</h2>
|
| 325 |
+
<p class="subtitle">خوش آمدید! لطفا اطلاعات خود را وارد کنید.</p>
|
| 326 |
+
|
| 327 |
+
<form onsubmit="handleLogin(event)">
|
| 328 |
+
<div class="input-group">
|
| 329 |
+
<label>شماره موبا��ل</label>
|
| 330 |
+
<div class="input-wrapper">
|
| 331 |
+
<input type="tel" id="loginPhone" placeholder="مثال: 09123456789" maxlength="11">
|
| 332 |
+
</div>
|
| 333 |
+
</div>
|
| 334 |
+
|
| 335 |
+
<div class="input-group">
|
| 336 |
+
<label>رمز عبور</label>
|
| 337 |
+
<div class="input-wrapper">
|
| 338 |
+
<input type="password" id="loginPass" placeholder="رمز عبور خود را وارد کنید">
|
| 339 |
+
</div>
|
| 340 |
+
</div>
|
| 341 |
+
|
| 342 |
+
<div class="input-group">
|
| 343 |
+
<label>کد امنیتی</label>
|
| 344 |
+
<div class="captcha-container">
|
| 345 |
+
<div class="captcha-wrapper" onclick="generateCaptcha('loginCanvas')" title="برای تعویض کد کلیک کنید">
|
| 346 |
+
<canvas id="loginCanvas" width="100" height="45"></canvas>
|
| 347 |
+
</div>
|
| 348 |
+
<button type="button" class="refresh-btn" onclick="generateCaptcha('loginCanvas')">↻</button>
|
| 349 |
+
<input type="text" id="loginCaptchaInput" placeholder="کد را وارد کنید" maxlength="5">
|
| 350 |
+
</div>
|
| 351 |
+
</div>
|
| 352 |
+
|
| 353 |
+
<button type="submit" class="btn">ورود</button>
|
| 354 |
+
</form>
|
| 355 |
+
|
| 356 |
+
<div class="toggle-text">
|
| 357 |
+
حساب کاربری ندارید؟ <a onclick="toggleForm('register')">ثبت نام کنید</a>
|
| 358 |
+
</div>
|
| 359 |
+
</div>
|
| 360 |
+
|
| 361 |
+
<!-- فرم ثبت نام -->
|
| 362 |
+
<div class="form-content" id="registerForm">
|
| 363 |
+
<h2>ثبت نام</h2>
|
| 364 |
+
<p class="subtitle">یک حساب جدید بسازید و به ما بپیوندید.</p>
|
| 365 |
+
|
| 366 |
+
<form onsubmit="handleRegister(event)">
|
| 367 |
+
<div class="input-group">
|
| 368 |
+
<label>شماره موبایل</label>
|
| 369 |
+
<div class="input-wrapper">
|
| 370 |
+
<input type="tel" id="regPhone" placeholder="مثال: 09123456789" maxlength="11">
|
| 371 |
+
</div>
|
| 372 |
+
</div>
|
| 373 |
+
|
| 374 |
+
<div class="input-group">
|
| 375 |
+
<label>رمز عبور</label>
|
| 376 |
+
<div class="input-wrapper">
|
| 377 |
+
<input type="password" id="regPass" placeholder="حداقل ۶ کاراکتر">
|
| 378 |
+
</div>
|
| 379 |
+
</div>
|
| 380 |
+
|
| 381 |
+
<div class="input-group">
|
| 382 |
+
<label>تکرار رمز عبور</label>
|
| 383 |
+
<div class="input-wrapper">
|
| 384 |
+
<input type="password" id="regPassConfirm" placeholder="تکرار رمز عبور">
|
| 385 |
+
</div>
|
| 386 |
+
</div>
|
| 387 |
+
|
| 388 |
+
<div class="input-group">
|
| 389 |
+
<label>کد امنیتی</label>
|
| 390 |
+
<div class="captcha-container">
|
| 391 |
+
<div class="captcha-wrapper" onclick="generateCaptcha('regCanvas')" title="برای تعویض کد کلیک کنید">
|
| 392 |
+
<canvas id="regCanvas" width="100" height="45"></canvas>
|
| 393 |
+
</div>
|
| 394 |
+
<button type="button" class="refresh-btn" onclick="generateCaptcha('regCanvas')">↻</button>
|
| 395 |
+
<input type="text" id="regCaptchaInput" placeholder="کد را وارد کنید" maxlength="5">
|
| 396 |
+
</div>
|
| 397 |
+
</div>
|
| 398 |
+
|
| 399 |
+
<button type="submit" class="btn">ثبت نام</button>
|
| 400 |
+
</form>
|
| 401 |
+
|
| 402 |
+
<div class="toggle-text">
|
| 403 |
+
قبلاً ثبت نام کردهاید؟ <a onclick="toggleForm('login')">وارد شوید</a>
|
| 404 |
+
</div>
|
| 405 |
+
</div>
|
| 406 |
+
|
| 407 |
+
</div>
|
| 408 |
+
</div>
|
| 409 |
+
|
| 410 |
+
<!-- کانتینر برای نمایش پیامها -->
|
| 411 |
+
<div class="toast-container" id="toastContainer"></div>
|
| 412 |
+
|
| 413 |
+
<script>
|
| 414 |
+
// متغیرهای سراسری برای ذخیره کد کپچا
|
| 415 |
+
let captchaCodes = {
|
| 416 |
+
login: '',
|
| 417 |
+
register: ''
|
| 418 |
+
};
|
| 419 |
+
|
| 420 |
+
// اجرای اولیه هنگام لود شدن صفحه
|
| 421 |
+
window.onload = function() {
|
| 422 |
+
generateCaptcha('loginCanvas');
|
| 423 |
+
generateCaptcha('regCanvas');
|
| 424 |
+
};
|
| 425 |
+
|
| 426 |
+
// تابع تولید کد کپچا و رسم روی Canvas
|
| 427 |
+
function generateCaptcha(canvasId) {
|
| 428 |
+
const canvas = document.getElementById(canvasId);
|
| 429 |
+
const ctx = canvas.getContext('2d');
|
| 430 |
+
const width = canvas.width;
|
| 431 |
+
const height = canvas.height;
|
| 432 |
+
|
| 433 |
+
// پاک کردن بوم
|
| 434 |
+
ctx.clearRect(0, 0, width, height);
|
| 435 |
+
|
| 436 |
+
// پسزمینه نویز (خطوط و نقاط)
|
| 437 |
+
ctx.fillStyle = '#f3f3f3';
|
| 438 |
+
ctx.fillRect(0, 0, width, height);
|
| 439 |
+
for (let i = 0; i < 7; i++) {
|
| 440 |
+
ctx.strokeStyle = `rgba(0,0,0,${Math.random() * 0.2})`;
|
| 441 |
+
ctx.beginPath();
|
| 442 |
+
ctx.moveTo(Math.random() * width, Math.random() * height);
|
| 443 |
+
ctx.lineTo(Math.random() * width, Math.random() * height);
|
| 444 |
+
ctx.stroke();
|
| 445 |
+
}
|
| 446 |
+
|
| 447 |
+
// تولید کد رندوم ۵ رقمی (فقط اعداد برای سادگی موبایل)
|
| 448 |
+
let code = '';
|
| 449 |
+
const chars = '0123456789';
|
| 450 |
+
for (let i = 0; i < 5; i++) {
|
| 451 |
+
code += chars[Math.floor(Math.random() * chars.length)];
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
// ذخیره کد در متغیر مربوطه
|
| 455 |
+
if(canvasId === 'loginCanvas') captchaCodes.login = code;
|
| 456 |
+
else captchaCodes.register = code;
|
| 457 |
+
|
| 458 |
+
// رسم متن با چرخش و فونت تصادفی
|
| 459 |
+
ctx.font = 'bold 24px Courier New';
|
| 460 |
+
ctx.textBaseline = 'middle';
|
| 461 |
+
|
| 462 |
+
for (let i = 0; i < code.length; i++) {
|
| 463 |
+
ctx.save();
|
| 464 |
+
// جابجایی و چرخش هر کاراکتر
|
| 465 |
+
const x = 15 + i * 18;
|
| 466 |
+
const y = height / 2 + (Math.random() * 10 - 5);
|
| 467 |
+
const angle = (Math.random() * 0.4) - 0.2;
|
| 468 |
+
|
| 469 |
+
ctx.translate(x, y);
|
| 470 |
+
ctx.rotate(angle);
|
| 471 |
+
ctx.fillStyle = `rgb(${Math.random()*100}, ${Math.random()*100}, ${Math.random()*100})`;
|
| 472 |
+
ctx.fillText(code[i], 0, 0);
|
| 473 |
+
ctx.restore();
|
| 474 |
+
}
|
| 475 |
+
}
|
| 476 |
+
|
| 477 |
+
// تابع سوئیچ بین فرم ورود و ثبت نام
|
| 478 |
+
function toggleForm(target) {
|
| 479 |
+
const wrapper = document.getElementById('formsWrapper');
|
| 480 |
+
const loginForm = document.getElementById('loginForm');
|
| 481 |
+
const regForm = document.getElementById('registerForm');
|
| 482 |
+
|
| 483 |
+
if (target === 'register') {
|
| 484 |
+
// انیمیشن ساده جابجایی
|
| 485 |
+
loginForm.classList.remove('active');
|
| 486 |
+
setTimeout(() => {
|
| 487 |
+
loginForm.style.display = 'none';
|
| 488 |
+
regForm.style.display = 'flex';
|
| 489 |
+
// رفرش کپچا هنگام باز شدن برای امنیت بیشتر
|
| 490 |
+
generateCaptcha('regCanvas');
|
| 491 |
+
setTimeout(() => regForm.classList.add('active'), 50);
|
| 492 |
+
}, 300);
|
| 493 |
+
} else {
|
| 494 |
+
regForm.classList.remove('active');
|
| 495 |
+
setTimeout(() => {
|
| 496 |
+
regForm.style.display = 'none';
|
| 497 |
+
loginForm.style.display = 'flex';
|
| 498 |
+
generateCaptcha('loginCanvas');
|
| 499 |
+
setTimeout(() => loginForm.classList.add('active'), 50);
|
| 500 |
+
}, 300);
|
| 501 |
+
}
|
| 502 |
+
}
|
| 503 |
+
|
| 504 |
+
// هندل کردن فرم ورود
|
| 505 |
+
function handleLogin(e) {
|
| 506 |
+
e.preventDefault();
|
| 507 |
+
const phone = document.getElementById('loginPhone').value;
|
| 508 |
+
const pass = document.getElementById('loginPass').value;
|
| 509 |
+
const userCaptcha = document.getElementById('loginCaptchaInput').value;
|
| 510 |
+
|
| 511 |
+
// اعتبارسنجی
|
| 512 |
+
if (!validatePhone(phone)) return showToast('شماره موبایل نامعتبر است', 'error');
|
| 513 |
+
if (pass.length < 4) return showToast('رمز عبور کوتاه است', 'error');
|
| 514 |
+
if (userCaptcha !== captchaCodes.login) {
|
| 515 |
+
generateCaptcha('loginCanvas'); // کپچا را عوض کن اگر اشتباه بود
|
| 516 |
+
return showToast('کد امنیتی اشتباه است', 'error');
|
| 517 |
+
}
|
| 518 |
+
|
| 519 |
+
// شبیهسازی ورود موفق
|
| 520 |
+
showToast('در حال ورود...', 'success');
|
| 521 |
+
setTimeout(() => {
|
| 522 |
+
showToast('خوش آمدید! ورود موفقیت آمیز بود.', 'success');
|
| 523 |
+
}, 1500);
|
| 524 |
+
}
|
| 525 |
+
|
| 526 |
+
// هندل کردن فرم ثبت نام
|
| 527 |
+
function handleRegister(e) {
|
| 528 |
+
e.preventDefault();
|
| 529 |
+
const phone = document.getElementById('regPhone').value;
|
| 530 |
+
const pass = document.getElementById('regPass').value;
|
| 531 |
+
const confirmPass = document.getElementById('regPassConfirm').value;
|
| 532 |
+
const userCaptcha = document.getElementById('regCaptchaInput').value;
|
| 533 |
+
|
| 534 |
+
// اعتبارسنجی
|
| 535 |
+
if (!validatePhone(phone)) return showToast('شماره موبایل نامعتبر است', 'error');
|
| 536 |
+
if (pass.length < 6) return showToast('رمز عبور باید حداقل ۶ کاراکتر باشد', 'error');
|
| 537 |
+
if (pass !== confirmPass) return showToast('تکرار رمز عبور مطابقت ندارد', 'error');
|
| 538 |
+
if (userCaptcha !== captchaCodes.register) {
|
| 539 |
+
generateCaptcha('regCanvas');
|
| 540 |
+
return showToast('کد امنیتی اشتباه است', 'error');
|
| 541 |
+
}
|
| 542 |
+
|
| 543 |
+
// شبیهسازی ثبت نام موفق
|
| 544 |
+
showToast('در حال ثبت نام...', 'success');
|
| 545 |
+
setTimeout(() => {
|
| 546 |
+
showToast('حساب کاربری با موفقیت ساخته شد!', 'success');
|
| 547 |
+
toggleForm('login'); // انتقال به صفحه لاگین
|
| 548 |
+
}, 1500);
|
| 549 |
+
}
|
| 550 |
+
|
| 551 |
+
// تابع کمکی اعتبارسنجی شماره موبایل ایران
|
| 552 |
+
function validatePhone(phone) {
|
| 553 |
+
const regex = /^09\d{9}$/;
|
| 554 |
+
return regex.test(phone);
|
| 555 |
+
}
|
| 556 |
+
|
| 557 |
+
// تابع نمایش پیام (Toast)
|
| 558 |
+
function showToast(message, type = 'success') {
|
| 559 |
+
const container = document.getElementById('toastContainer');
|
| 560 |
+
const toast = document.createElement('div');
|
| 561 |
+
toast.className = `toast ${type}`;
|
| 562 |
+
|
| 563 |
+
// آیکون ساده بر اساس نوع
|
| 564 |
+
const icon = type === 'success' ? '✔' : '✖';
|
| 565 |
+
|
| 566 |
+
toast.innerHTML = `<span>${icon}</span> <span>${message}</span>`;
|
| 567 |
+
|
| 568 |
+
container.appendChild(toast);
|
| 569 |
+
|
| 570 |
+
// حذف خودکار بعد از ۳ ثانیه
|
| 571 |
+
setTimeout(() => {
|
| 572 |
+
toast.style.animation = 'fadeOut 0.3s forwards';
|
| 573 |
+
toast.addEventListener('animationend', () => {
|
| 574 |
+
toast.remove();
|
| 575 |
+
});
|
| 576 |
+
}, 3000);
|
| 577 |
+
}
|
| 578 |
+
</script>
|
| 579 |
+
</body>
|
| 580 |
+
</html>
|