Spaces:
Running
Running
Update login.html
Browse files- login.html +256 -46
login.html
CHANGED
|
@@ -14,24 +14,24 @@
|
|
| 14 |
}
|
| 15 |
|
| 16 |
body {
|
| 17 |
-
background: #f5f5f5;
|
| 18 |
min-height: 100vh;
|
| 19 |
display: flex;
|
| 20 |
align-items: center;
|
| 21 |
justify-content: center;
|
| 22 |
position: relative;
|
| 23 |
padding: 20px;
|
|
|
|
|
|
|
| 24 |
}
|
| 25 |
|
| 26 |
body::before {
|
| 27 |
content: '';
|
| 28 |
-
position:
|
| 29 |
top: 0;
|
| 30 |
left: 0;
|
| 31 |
right: 0;
|
| 32 |
-
|
| 33 |
-
background: linear-gradient(135deg,
|
| 34 |
-
clip-path: polygon(0 0, 100% 0, 100% 85%, 0 100%);
|
| 35 |
z-index: 0;
|
| 36 |
}
|
| 37 |
|
|
@@ -40,29 +40,25 @@
|
|
| 40 |
top: 40px;
|
| 41 |
left: 50%;
|
| 42 |
transform: translateX(-50%);
|
| 43 |
-
width:
|
| 44 |
-
height:
|
| 45 |
-
background:
|
| 46 |
-
border-radius:
|
| 47 |
-
padding:
|
| 48 |
-
box-shadow: 0
|
| 49 |
display: flex;
|
| 50 |
align-items: center;
|
| 51 |
justify-content: center;
|
| 52 |
z-index: 2;
|
| 53 |
-
|
|
|
|
| 54 |
}
|
| 55 |
|
| 56 |
.logo {
|
| 57 |
width: 100%;
|
| 58 |
height: 100%;
|
| 59 |
object-fit: contain;
|
| 60 |
-
border-radius:
|
| 61 |
-
transition: transform 0.3s ease;
|
| 62 |
-
}
|
| 63 |
-
|
| 64 |
-
.logo:hover {
|
| 65 |
-
transform: scale(1.05);
|
| 66 |
}
|
| 67 |
|
| 68 |
.container {
|
|
@@ -70,7 +66,7 @@
|
|
| 70 |
width: 400px;
|
| 71 |
min-height: 580px;
|
| 72 |
perspective: 1000px;
|
| 73 |
-
margin-top:
|
| 74 |
z-index: 1;
|
| 75 |
}
|
| 76 |
|
|
@@ -91,11 +87,12 @@
|
|
| 91 |
width: 100%;
|
| 92 |
height: 100%;
|
| 93 |
padding: 40px;
|
| 94 |
-
background:
|
| 95 |
border-radius: 20px;
|
| 96 |
-
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.
|
| 97 |
backface-visibility: hidden;
|
| 98 |
-
border: 1px solid rgba(
|
|
|
|
| 99 |
}
|
| 100 |
|
| 101 |
.register-form {
|
|
@@ -120,7 +117,7 @@
|
|
| 120 |
transform: translateX(-50%);
|
| 121 |
width: 60px;
|
| 122 |
height: 3px;
|
| 123 |
-
background: linear-gradient(90deg, #
|
| 124 |
border-radius: 2px;
|
| 125 |
}
|
| 126 |
|
|
@@ -132,28 +129,28 @@
|
|
| 132 |
input {
|
| 133 |
width: 100%;
|
| 134 |
padding: 15px 20px;
|
| 135 |
-
border: 2px solid
|
| 136 |
border-radius: 12px;
|
| 137 |
font-size: 16px;
|
| 138 |
transition: all 0.3s ease;
|
| 139 |
-
background:
|
| 140 |
color: #333;
|
| 141 |
}
|
| 142 |
|
| 143 |
input:focus {
|
| 144 |
-
border-color: #
|
| 145 |
background: white;
|
| 146 |
-
box-shadow: 0 0
|
| 147 |
outline: none;
|
| 148 |
}
|
| 149 |
|
| 150 |
button {
|
| 151 |
width: 100%;
|
| 152 |
padding: 15px;
|
| 153 |
-
background: linear-gradient(135deg, #
|
| 154 |
border: none;
|
| 155 |
border-radius: 12px;
|
| 156 |
-
color:
|
| 157 |
font-size: 18px;
|
| 158 |
font-weight: 600;
|
| 159 |
cursor: pointer;
|
|
@@ -165,34 +162,90 @@
|
|
| 165 |
|
| 166 |
button:hover {
|
| 167 |
transform: translateY(-2px);
|
| 168 |
-
box-shadow: 0 5px
|
| 169 |
-
background: linear-gradient(135deg, #333 0%, #000 100%);
|
| 170 |
}
|
| 171 |
|
| 172 |
.toggle-btn {
|
| 173 |
background: transparent;
|
| 174 |
-
color: #
|
| 175 |
-
border: 2px solid #
|
| 176 |
font-weight: 500;
|
| 177 |
padding: 12px 25px;
|
| 178 |
}
|
| 179 |
|
| 180 |
.toggle-btn:hover {
|
| 181 |
-
background: #
|
| 182 |
color: white;
|
| 183 |
}
|
| 184 |
|
| 185 |
-
|
| 186 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
@keyframes float {
|
| 188 |
0% {
|
| 189 |
-
transform:
|
| 190 |
}
|
| 191 |
50% {
|
| 192 |
-
transform:
|
| 193 |
}
|
| 194 |
100% {
|
| 195 |
-
transform:
|
| 196 |
}
|
| 197 |
}
|
| 198 |
|
|
@@ -200,11 +253,13 @@
|
|
| 200 |
animation: float 6s ease-in-out infinite;
|
| 201 |
}
|
| 202 |
|
|
|
|
| 203 |
.decoration {
|
| 204 |
position: absolute;
|
| 205 |
-
background: linear-gradient(135deg, #
|
| 206 |
-
opacity: 0.
|
| 207 |
border-radius: 50%;
|
|
|
|
| 208 |
}
|
| 209 |
|
| 210 |
.decoration-1 {
|
|
@@ -220,14 +275,169 @@
|
|
| 220 |
bottom: -75px;
|
| 221 |
left: -75px;
|
| 222 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
</style>
|
| 224 |
</head>
|
| 225 |
<body>
|
|
|
|
| 226 |
<div class="logo-container">
|
| 227 |
-
<img src="https://ufastpro.com/wp-content/uploads/
|
| 228 |
</div>
|
| 229 |
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
}
|
| 15 |
|
| 16 |
body {
|
|
|
|
| 17 |
min-height: 100vh;
|
| 18 |
display: flex;
|
| 19 |
align-items: center;
|
| 20 |
justify-content: center;
|
| 21 |
position: relative;
|
| 22 |
padding: 20px;
|
| 23 |
+
background: url('https://ufastpro.com/wp-content/uploads/2025/01/Black-Gold-Modern-Law-Firm-Presentation.png') no-repeat center center fixed;
|
| 24 |
+
background-size: cover;
|
| 25 |
}
|
| 26 |
|
| 27 |
body::before {
|
| 28 |
content: '';
|
| 29 |
+
position: fixed;
|
| 30 |
top: 0;
|
| 31 |
left: 0;
|
| 32 |
right: 0;
|
| 33 |
+
bottom: 0;
|
| 34 |
+
background: linear-gradient(135deg, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.7) 100%);
|
|
|
|
| 35 |
z-index: 0;
|
| 36 |
}
|
| 37 |
|
|
|
|
| 40 |
top: 40px;
|
| 41 |
left: 50%;
|
| 42 |
transform: translateX(-50%);
|
| 43 |
+
width: 150px;
|
| 44 |
+
height: 150px;
|
| 45 |
+
background: rgba(255, 255, 255, 0.95);
|
| 46 |
+
border-radius: 50%;
|
| 47 |
+
padding: 10px;
|
| 48 |
+
box-shadow: 0 4px 30px rgba(218, 165, 32, 0.3);
|
| 49 |
display: flex;
|
| 50 |
align-items: center;
|
| 51 |
justify-content: center;
|
| 52 |
z-index: 2;
|
| 53 |
+
backdrop-filter: blur(5px);
|
| 54 |
+
border: 2px solid rgba(218, 165, 32, 0.3);
|
| 55 |
}
|
| 56 |
|
| 57 |
.logo {
|
| 58 |
width: 100%;
|
| 59 |
height: 100%;
|
| 60 |
object-fit: contain;
|
| 61 |
+
border-radius: 50%;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
|
| 64 |
.container {
|
|
|
|
| 66 |
width: 400px;
|
| 67 |
min-height: 580px;
|
| 68 |
perspective: 1000px;
|
| 69 |
+
margin-top: 100px;
|
| 70 |
z-index: 1;
|
| 71 |
}
|
| 72 |
|
|
|
|
| 87 |
width: 100%;
|
| 88 |
height: 100%;
|
| 89 |
padding: 40px;
|
| 90 |
+
background: rgba(255, 255, 255, 0.95);
|
| 91 |
border-radius: 20px;
|
| 92 |
+
box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
|
| 93 |
backface-visibility: hidden;
|
| 94 |
+
border: 1px solid rgba(218, 165, 32, 0.3);
|
| 95 |
+
backdrop-filter: blur(10px);
|
| 96 |
}
|
| 97 |
|
| 98 |
.register-form {
|
|
|
|
| 117 |
transform: translateX(-50%);
|
| 118 |
width: 60px;
|
| 119 |
height: 3px;
|
| 120 |
+
background: linear-gradient(90deg, #DAA520, #FFD700);
|
| 121 |
border-radius: 2px;
|
| 122 |
}
|
| 123 |
|
|
|
|
| 129 |
input {
|
| 130 |
width: 100%;
|
| 131 |
padding: 15px 20px;
|
| 132 |
+
border: 2px solid rgba(218, 165, 32, 0.3);
|
| 133 |
border-radius: 12px;
|
| 134 |
font-size: 16px;
|
| 135 |
transition: all 0.3s ease;
|
| 136 |
+
background: rgba(255, 255, 255, 0.9);
|
| 137 |
color: #333;
|
| 138 |
}
|
| 139 |
|
| 140 |
input:focus {
|
| 141 |
+
border-color: #DAA520;
|
| 142 |
background: white;
|
| 143 |
+
box-shadow: 0 0 20px rgba(218, 165, 32, 0.2);
|
| 144 |
outline: none;
|
| 145 |
}
|
| 146 |
|
| 147 |
button {
|
| 148 |
width: 100%;
|
| 149 |
padding: 15px;
|
| 150 |
+
background: linear-gradient(135deg, #DAA520 0%, #FFD700 100%);
|
| 151 |
border: none;
|
| 152 |
border-radius: 12px;
|
| 153 |
+
color: #000;
|
| 154 |
font-size: 18px;
|
| 155 |
font-weight: 600;
|
| 156 |
cursor: pointer;
|
|
|
|
| 162 |
|
| 163 |
button:hover {
|
| 164 |
transform: translateY(-2px);
|
| 165 |
+
box-shadow: 0 5px 20px rgba(218, 165, 32, 0.4);
|
|
|
|
| 166 |
}
|
| 167 |
|
| 168 |
.toggle-btn {
|
| 169 |
background: transparent;
|
| 170 |
+
color: #DAA520;
|
| 171 |
+
border: 2px solid #DAA520;
|
| 172 |
font-weight: 500;
|
| 173 |
padding: 12px 25px;
|
| 174 |
}
|
| 175 |
|
| 176 |
.toggle-btn:hover {
|
| 177 |
+
background: #DAA520;
|
| 178 |
color: white;
|
| 179 |
}
|
| 180 |
|
| 181 |
+
.message {
|
| 182 |
+
margin-top: 15px;
|
| 183 |
+
text-align: center;
|
| 184 |
+
padding: 12px;
|
| 185 |
+
border-radius: 12px;
|
| 186 |
+
font-size: 14px;
|
| 187 |
+
opacity: 0;
|
| 188 |
+
transition: opacity 0.3s ease;
|
| 189 |
+
}
|
| 190 |
+
|
| 191 |
+
.message.show {
|
| 192 |
+
opacity: 1;
|
| 193 |
+
}
|
| 194 |
+
|
| 195 |
+
.error {
|
| 196 |
+
color: #D32F2F;
|
| 197 |
+
background-color: rgba(255, 235, 238, 0.9);
|
| 198 |
+
border: 1px solid #FFCDD2;
|
| 199 |
+
}
|
| 200 |
+
|
| 201 |
+
.success {
|
| 202 |
+
color: #388E3C;
|
| 203 |
+
background-color: rgba(232, 245, 233, 0.9);
|
| 204 |
+
border: 1px solid #C8E6C9;
|
| 205 |
+
}
|
| 206 |
+
|
| 207 |
+
.form-footer {
|
| 208 |
+
text-align: center;
|
| 209 |
+
margin-top: 25px;
|
| 210 |
+
font-size: 14px;
|
| 211 |
+
color: #333;
|
| 212 |
+
padding: 15px;
|
| 213 |
+
border-top: 1px solid rgba(218, 165, 32, 0.2);
|
| 214 |
+
}
|
| 215 |
+
|
| 216 |
+
.terms {
|
| 217 |
+
font-size: 13px;
|
| 218 |
+
color: #555;
|
| 219 |
+
text-align: center;
|
| 220 |
+
margin-top: 15px;
|
| 221 |
+
line-height: 1.6;
|
| 222 |
+
}
|
| 223 |
+
|
| 224 |
+
@media (max-width: 480px) {
|
| 225 |
+
.container {
|
| 226 |
+
width: 100%;
|
| 227 |
+
max-width: 380px;
|
| 228 |
+
}
|
| 229 |
+
|
| 230 |
+
.form-box {
|
| 231 |
+
padding: 30px 20px;
|
| 232 |
+
}
|
| 233 |
+
|
| 234 |
+
h2 {
|
| 235 |
+
font-size: 24px;
|
| 236 |
+
}
|
| 237 |
+
}
|
| 238 |
+
|
| 239 |
+
/* Animations */
|
| 240 |
@keyframes float {
|
| 241 |
0% {
|
| 242 |
+
transform: translateX(-50%) translateY(0px);
|
| 243 |
}
|
| 244 |
50% {
|
| 245 |
+
transform: translateX(-50%) translateY(-10px);
|
| 246 |
}
|
| 247 |
100% {
|
| 248 |
+
transform: translateX(-50%) translateY(0px);
|
| 249 |
}
|
| 250 |
}
|
| 251 |
|
|
|
|
| 253 |
animation: float 6s ease-in-out infinite;
|
| 254 |
}
|
| 255 |
|
| 256 |
+
/* Additional decorative elements */
|
| 257 |
.decoration {
|
| 258 |
position: absolute;
|
| 259 |
+
background: linear-gradient(135deg, #DAA520 0%, #FFD700 100%);
|
| 260 |
+
opacity: 0.1;
|
| 261 |
border-radius: 50%;
|
| 262 |
+
filter: blur(3px);
|
| 263 |
}
|
| 264 |
|
| 265 |
.decoration-1 {
|
|
|
|
| 275 |
bottom: -75px;
|
| 276 |
left: -75px;
|
| 277 |
}
|
| 278 |
+
|
| 279 |
+
/* Glowing effect */
|
| 280 |
+
.form-box::before {
|
| 281 |
+
content: '';
|
| 282 |
+
position: absolute;
|
| 283 |
+
top: -2px;
|
| 284 |
+
left: -2px;
|
| 285 |
+
right: -2px;
|
| 286 |
+
bottom: -2px;
|
| 287 |
+
background: linear-gradient(45deg, #DAA520, #FFD700, #DAA520);
|
| 288 |
+
border-radius: 22px;
|
| 289 |
+
z-index: -1;
|
| 290 |
+
filter: blur(10px);
|
| 291 |
+
opacity: 0;
|
| 292 |
+
transition: opacity 0.3s ease;
|
| 293 |
+
}
|
| 294 |
+
|
| 295 |
+
.form-box:hover::before {
|
| 296 |
+
opacity: 0.3;
|
| 297 |
+
}
|
| 298 |
</style>
|
| 299 |
</head>
|
| 300 |
<body>
|
| 301 |
+
<!-- Rest of the HTML remains the same as in the original -->
|
| 302 |
<div class="logo-container">
|
| 303 |
+
<img src="https://ufastpro.com/wp-content/uploads/2024/11/تصميم-بدون-عنوان-3.png" alt="Logo" class="logo">
|
| 304 |
</div>
|
| 305 |
|
| 306 |
+
<div class="container">
|
| 307 |
+
<div class="forms-container">
|
| 308 |
+
<!-- Login Form -->
|
| 309 |
+
<div class="form-box login-form">
|
| 310 |
+
<div class="decoration decoration-1"></div>
|
| 311 |
+
<div class="decoration decoration-2"></div>
|
| 312 |
+
<h2>مرحباً بعودتك</h2>
|
| 313 |
+
<div class="input-group">
|
| 314 |
+
<input type="text" id="loginUsername" placeholder="البريد الإلكتروني">
|
| 315 |
+
</div>
|
| 316 |
+
<div class="input-group">
|
| 317 |
+
<input type="password" id="loginPassword" placeholder="كلمة المرور">
|
| 318 |
+
</div>
|
| 319 |
+
<button onclick="login()">تسجيل الدخول</button>
|
| 320 |
+
<div id="loginMessage" class="message"></div>
|
| 321 |
+
<div class="toggle-form">
|
| 322 |
+
<button class="toggle-btn" onclick="toggleForm()">إنشاء حساب جديد</button>
|
| 323 |
+
</div>
|
| 324 |
+
<div class="form-footer">
|
| 325 |
+
منصة ذكاء اصطناعي قانوني موثوقة ومرخصة
|
| 326 |
+
</div>
|
| 327 |
+
</div>
|
| 328 |
+
|
| 329 |
+
<!-- Register Form -->
|
| 330 |
+
<div class="form-box register-form">
|
| 331 |
+
<div class="decoration decoration-1"></div>
|
| 332 |
+
<div class="decoration decoration-2"></div>
|
| 333 |
+
<h2>حساب جديد</h2>
|
| 334 |
+
<div class="input-group">
|
| 335 |
+
<input type="text" id="registerUsername" placeholder="البريد الإلكتروني">
|
| 336 |
+
</div>
|
| 337 |
+
<div class="input-group">
|
| 338 |
+
<input type="password" id="registerPassword" placeholder="كلمة المرور">
|
| 339 |
+
</div>
|
| 340 |
+
<button onclick="register()">إنشاء الحساب</button>
|
| 341 |
+
<div id="registerMessage" class="message"></div>
|
| 342 |
+
<div class="toggle-form">
|
| 343 |
+
<button class="toggle-btn" onclick="toggleForm()">العودة لتسجيل الدخول</button>
|
| 344 |
+
</div>
|
| 345 |
+
<div class="terms">
|
| 346 |
+
بالتسجيل، أنت توافق على الشروط والأحكام وسياسة الخصوصية
|
| 347 |
+
</div>
|
| 348 |
+
</div>
|
| 349 |
+
</div>
|
| 350 |
+
</div>
|
| 351 |
+
|
| 352 |
+
<script>
|
| 353 |
+
// JavaScript remains the same as in the original
|
| 354 |
+
const API_URL = 'https://j8fp9mu44k547j-7777.proxy.runpod.net/proxy/6500/api';
|
| 355 |
+
|
| 356 |
+
function toggleForm() {
|
| 357 |
+
document.querySelector('.forms-container').classList.toggle('flipped');
|
| 358 |
+
}
|
| 359 |
+
|
| 360 |
+
function showMessage(elementId, message, isError = false) {
|
| 361 |
+
const element = document.getElementById(elementId);
|
| 362 |
+
element.textContent = message;
|
| 363 |
+
element.className = `message ${isError ? 'error' : 'success'} show`;
|
| 364 |
+
setTimeout(() => {
|
| 365 |
+
element.className = 'message';
|
| 366 |
+
}, 3000);
|
| 367 |
+
}
|
| 368 |
+
|
| 369 |
+
async function login() {
|
| 370 |
+
const username = document.getElementById('loginUsername').value;
|
| 371 |
+
const password = document.getElementById('loginPassword').value;
|
| 372 |
+
|
| 373 |
+
if (!username || !password) {
|
| 374 |
+
showMessage('loginMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
|
| 375 |
+
return;
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
if (!isValidEmail(username)) {
|
| 379 |
+
showMessage('loginMessage', 'الرجاء إدخال بريد إلكتروني صحيح', true);
|
| 380 |
+
return;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
try {
|
| 384 |
+
const response = await fetch(`${API_URL}/login`, {
|
| 385 |
+
method: 'POST',
|
| 386 |
+
headers: {
|
| 387 |
+
'Content-Type': 'application/json'
|
| 388 |
+
},
|
| 389 |
+
body: JSON.stringify({ username, password })
|
| 390 |
+
});
|
| 391 |
+
|
| 392 |
+
const data = await response.json();
|
| 393 |
+
|
| 394 |
+
if (response.ok) {
|
| 395 |
+
showMessage('loginMessage', 'تم تسجيل الدخول بنجاح');
|
| 396 |
+
setTimeout(() => {
|
| 397 |
+
window.location.href = data.redirect_url;
|
| 398 |
+
}, 1000);
|
| 399 |
+
} else {
|
| 400 |
+
showMessage('loginMessage', data.detail, true);
|
| 401 |
+
}
|
| 402 |
+
} catch (error) {
|
| 403 |
+
showMessage('loginMessage', 'حدث خطأ في الاتصال', true);
|
| 404 |
+
}
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
async function register() {
|
| 408 |
+
const username = document.getElementById('registerUsername').value;
|
| 409 |
+
const password = document.getElementById('registerPassword').value;
|
| 410 |
+
|
| 411 |
+
if (!username || !password) {
|
| 412 |
+
showMessage('registerMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
|
| 413 |
+
return;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
if (!isValidEmail(username)) {
|
| 417 |
+
showMessage('registerMessage', 'الرجاء إدخال بريد إلكتروني صحيح', true);
|
| 418 |
+
return;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
if (password.length < 8) {
|
| 422 |
+
showMessage('registerMessage', 'كلمة المرور يجب أن تكون 8 أحرف على الأقل', true);
|
| 423 |
+
return;
|
| 424 |
+
}
|
| 425 |
+
|
| 426 |
+
try {
|
| 427 |
+
const response = await fetch(`${API_URL}/register`, {
|
| 428 |
+
method: 'POST',
|
| 429 |
+
headers: {
|
| 430 |
+
'Content-Type': 'application/json'
|
| 431 |
+
},
|
| 432 |
+
body: JSON.stringify({ username, password })
|
| 433 |
+
});
|
| 434 |
+
|
| 435 |
+
const data = await response.json();
|
| 436 |
+
|
| 437 |
+
if (response.ok) {
|
| 438 |
+
showMessage('registerMessage', 'تم إنشاء الحساب بنجاح');
|
| 439 |
+
document.getElementById('registerUsername').value = '';
|
| 440 |
+
document.getElementById('registerPassword').value = '';
|
| 441 |
+
setTimeout(() => {
|
| 442 |
+
toggleForm();
|
| 443 |
+
}, 1500);
|