joermd commited on
Commit
27ea40c
·
verified ·
1 Parent(s): fa11e5c

Update login.html

Browse files
Files changed (1) hide show
  1. login.html +178 -51
login.html CHANGED
@@ -4,6 +4,7 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>نظام تسجيل الدخول</title>
 
7
  <style>
8
  * {
9
  margin: 0;
@@ -11,126 +12,229 @@
11
  box-sizing: border-box;
12
  font-family: 'Tajawal', sans-serif;
13
  }
 
14
  body {
15
- background: linear-gradient(120deg, #2980b9, #8e44ad);
16
  height: 100vh;
17
  display: flex;
18
  align-items: center;
19
  justify-content: center;
 
 
 
 
 
 
 
 
 
 
20
  }
 
21
  .container {
 
 
 
 
 
 
 
 
 
22
  width: 100%;
23
- max-width: 800px;
24
- padding: 20px;
25
- display: flex;
26
- gap: 20px;
 
 
 
27
  }
 
28
  .form-box {
29
- background: white;
 
 
30
  padding: 40px;
31
- border-radius: 10px;
32
- box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
33
- flex: 1;
 
34
  }
 
 
 
 
 
35
  h2 {
36
  text-align: center;
37
- color: #2c3e50;
38
  margin-bottom: 30px;
 
 
39
  }
 
40
  .input-group {
41
- margin-bottom: 20px;
 
42
  }
 
43
  input {
44
  width: 100%;
45
- padding: 12px;
46
- border: 1px solid #ddd;
47
- border-radius: 5px;
48
  font-size: 16px;
49
- transition: border-color 0.3s;
 
50
  }
 
51
  input:focus {
52
- border-color: #3498db;
 
53
  outline: none;
54
  }
 
55
  button {
56
  width: 100%;
57
- padding: 12px;
58
- background: #3498db;
59
  border: none;
60
- border-radius: 5px;
61
  color: white;
62
- font-size: 16px;
 
63
  cursor: pointer;
64
- transition: background 0.3s;
 
65
  }
 
66
  button:hover {
67
- background: #2980b9;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  }
 
69
  .message {
70
  margin-top: 15px;
71
  text-align: center;
72
- padding: 10px;
73
- border-radius: 5px;
 
 
 
74
  }
 
 
 
 
 
75
  .error {
76
  color: #e74c3c;
77
  background-color: #fde8e8;
78
  }
 
79
  .success {
80
  color: #2ecc71;
81
  background-color: #e8f8f0;
82
  }
83
- @media (max-width: 768px) {
84
- .container {
85
- flex-direction: column;
86
- }
 
 
 
 
 
87
  }
88
  </style>
89
  </head>
90
  <body>
 
 
91
  <div class="container">
92
- <!-- نموذج تسجيل الدخول -->
93
- <div class="form-box">
94
- <h2>تسجيل الدخول</h2>
95
- <div class="input-group">
96
- <input type="text" id="loginUsername" placeholder="اسم المستخدم">
97
- </div>
98
- <div class="input-group">
99
- <input type="password" id="loginPassword" placeholder="كلمة المرور">
 
 
 
 
 
 
 
100
  </div>
101
- <button onclick="login()">دخول</button>
102
- <div id="loginMessage" class="message"></div>
103
- </div>
104
 
105
- <!-- نموذج إنشاء حساب -->
106
- <div class="form-box">
107
- <h2>إنشاء حساب جديد</h2>
108
- <div class="input-group">
109
- <input type="text" id="registerUsername" placeholder="اسم المستخدم">
110
- </div>
111
- <div class="input-group">
112
- <input type="password" id="registerPassword" placeholder="كلمة المرور">
 
 
 
 
 
 
113
  </div>
114
- <button onclick="register()">إنشاء حساب</button>
115
- <div id="registerMessage" class="message"></div>
116
  </div>
117
  </div>
118
 
119
  <script>
120
  const API_URL = 'https://j8fp9mu44k547j-7777.proxy.runpod.net/proxy/6500/api';
 
 
 
 
 
121
  function showMessage(elementId, message, isError = false) {
122
  const element = document.getElementById(elementId);
123
  element.textContent = message;
124
- element.className = `message ${isError ? 'error' : 'success'}`;
125
  setTimeout(() => {
126
- element.textContent = '';
127
  element.className = 'message';
128
  }, 3000);
129
  }
 
130
  async function login() {
131
  const username = document.getElementById('loginUsername').value;
132
  const password = document.getElementById('loginPassword').value;
133
 
 
 
 
 
 
134
  try {
135
  const response = await fetch(`${API_URL}/login`, {
136
  method: 'POST',
@@ -154,10 +258,16 @@
154
  showMessage('loginMessage', 'حدث خطأ في الاتصال', true);
155
  }
156
  }
 
157
  async function register() {
158
  const username = document.getElementById('registerUsername').value;
159
  const password = document.getElementById('registerPassword').value;
160
 
 
 
 
 
 
161
  try {
162
  const response = await fetch(`${API_URL}/register`, {
163
  method: 'POST',
@@ -173,6 +283,9 @@
173
  showMessage('registerMessage', data.message);
174
  document.getElementById('registerUsername').value = '';
175
  document.getElementById('registerPassword').value = '';
 
 
 
176
  } else {
177
  showMessage('registerMessage', data.detail, true);
178
  }
@@ -180,6 +293,20 @@
180
  showMessage('registerMessage', 'حدث خطأ في الاتصال', true);
181
  }
182
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  </script>
184
  </body>
185
  </html>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>نظام تسجيل الدخول</title>
7
+ <link href="https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700&display=swap" rel="stylesheet">
8
  <style>
9
  * {
10
  margin: 0;
 
12
  box-sizing: border-box;
13
  font-family: 'Tajawal', sans-serif;
14
  }
15
+
16
  body {
17
+ background: linear-gradient(135deg, #00416A 0%, #E4E5E6 100%);
18
  height: 100vh;
19
  display: flex;
20
  align-items: center;
21
  justify-content: center;
22
+ overflow: hidden;
23
+ }
24
+
25
+ .logo {
26
+ position: absolute;
27
+ top: 20px;
28
+ left: 50%;
29
+ transform: translateX(-50%);
30
+ width: 150px;
31
+ height: auto;
32
  }
33
+
34
  .container {
35
+ position: relative;
36
+ width: 400px;
37
+ height: 500px;
38
+ perspective: 1000px;
39
+ margin-top: 50px;
40
+ }
41
+
42
+ .forms-container {
43
+ position: relative;
44
  width: 100%;
45
+ height: 100%;
46
+ transform-style: preserve-3d;
47
+ transition: transform 0.8s ease-in-out;
48
+ }
49
+
50
+ .forms-container.flipped {
51
+ transform: rotateY(180deg);
52
  }
53
+
54
  .form-box {
55
+ position: absolute;
56
+ width: 100%;
57
+ height: 100%;
58
  padding: 40px;
59
+ background: rgba(255, 255, 255, 0.9);
60
+ border-radius: 20px;
61
+ box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
62
+ backface-visibility: hidden;
63
  }
64
+
65
+ .register-form {
66
+ transform: rotateY(180deg);
67
+ }
68
+
69
  h2 {
70
  text-align: center;
71
+ color: #00416A;
72
  margin-bottom: 30px;
73
+ font-size: 28px;
74
+ font-weight: 700;
75
  }
76
+
77
  .input-group {
78
+ margin-bottom: 25px;
79
+ position: relative;
80
  }
81
+
82
  input {
83
  width: 100%;
84
+ padding: 15px;
85
+ border: 2px solid #e1e1e1;
86
+ border-radius: 10px;
87
  font-size: 16px;
88
+ transition: all 0.3s ease;
89
+ background: rgba(255, 255, 255, 0.9);
90
  }
91
+
92
  input:focus {
93
+ border-color: #00416A;
94
+ box-shadow: 0 0 10px rgba(0, 65, 106, 0.2);
95
  outline: none;
96
  }
97
+
98
  button {
99
  width: 100%;
100
+ padding: 15px;
101
+ background: #00416A;
102
  border: none;
103
+ border-radius: 10px;
104
  color: white;
105
+ font-size: 18px;
106
+ font-weight: 500;
107
  cursor: pointer;
108
+ transition: all 0.3s ease;
109
+ margin-bottom: 20px;
110
  }
111
+
112
  button:hover {
113
+ background: #005688;
114
+ transform: translateY(-2px);
115
+ box-shadow: 0 5px 15px rgba(0, 65, 106, 0.3);
116
+ }
117
+
118
+ .toggle-form {
119
+ text-align: center;
120
+ margin-top: 20px;
121
+ }
122
+
123
+ .toggle-btn {
124
+ background: transparent;
125
+ color: #00416A;
126
+ font-size: 16px;
127
+ padding: 10px 20px;
128
+ border: 2px solid #00416A;
129
+ border-radius: 8px;
130
+ cursor: pointer;
131
+ transition: all 0.3s ease;
132
+ }
133
+
134
+ .toggle-btn:hover {
135
+ background: #00416A;
136
+ color: white;
137
  }
138
+
139
  .message {
140
  margin-top: 15px;
141
  text-align: center;
142
+ padding: 12px;
143
+ border-radius: 8px;
144
+ font-size: 14px;
145
+ opacity: 0;
146
+ transition: opacity 0.3s ease;
147
  }
148
+
149
+ .message.show {
150
+ opacity: 1;
151
+ }
152
+
153
  .error {
154
  color: #e74c3c;
155
  background-color: #fde8e8;
156
  }
157
+
158
  .success {
159
  color: #2ecc71;
160
  background-color: #e8f8f0;
161
  }
162
+
163
+ /* Animation */
164
+ @keyframes fadeIn {
165
+ from { opacity: 0; transform: translateY(-20px); }
166
+ to { opacity: 1; transform: translateY(0); }
167
+ }
168
+
169
+ .form-box {
170
+ animation: fadeIn 0.5s ease-out;
171
  }
172
  </style>
173
  </head>
174
  <body>
175
+ <img src="https://ufastpro.com/wp-content/uploads/2024/11/تصميم-بدون-عنوان-3.png" alt="Logo" class="logo">
176
+
177
  <div class="container">
178
+ <div class="forms-container">
179
+ <!-- نموذج تسجيل الدخول -->
180
+ <div class="form-box login-form">
181
+ <h2>تسجيل الدخول</h2>
182
+ <div class="input-group">
183
+ <input type="text" id="loginUsername" placeholder="اسم المستخدم">
184
+ </div>
185
+ <div class="input-group">
186
+ <input type="password" id="loginPassword" placeholder="كلمة المرور">
187
+ </div>
188
+ <button onclick="login()">دخول</button>
189
+ <div id="loginMessage" class="message"></div>
190
+ <div class="toggle-form">
191
+ <button class="toggle-btn" onclick="toggleForm()">إنشاء حساب جديد</button>
192
+ </div>
193
  </div>
 
 
 
194
 
195
+ <!-- نموذج إنشاء حساب -->
196
+ <div class="form-box register-form">
197
+ <h2>إنشاء حساب جديد</h2>
198
+ <div class="input-group">
199
+ <input type="text" id="registerUsername" placeholder="اسم المستخدم">
200
+ </div>
201
+ <div class="input-group">
202
+ <input type="password" id="registerPassword" placeholder="كلمة المرور">
203
+ </div>
204
+ <button onclick="register()">إنشاء حساب</button>
205
+ <div id="registerMessage" class="message"></div>
206
+ <div class="toggle-form">
207
+ <button class="toggle-btn" onclick="toggleForm()">العودة لتسجيل الدخول</button>
208
+ </div>
209
  </div>
 
 
210
  </div>
211
  </div>
212
 
213
  <script>
214
  const API_URL = 'https://j8fp9mu44k547j-7777.proxy.runpod.net/proxy/6500/api';
215
+
216
+ function toggleForm() {
217
+ document.querySelector('.forms-container').classList.toggle('flipped');
218
+ }
219
+
220
  function showMessage(elementId, message, isError = false) {
221
  const element = document.getElementById(elementId);
222
  element.textContent = message;
223
+ element.className = `message ${isError ? 'error' : 'success'} show`;
224
  setTimeout(() => {
 
225
  element.className = 'message';
226
  }, 3000);
227
  }
228
+
229
  async function login() {
230
  const username = document.getElementById('loginUsername').value;
231
  const password = document.getElementById('loginPassword').value;
232
 
233
+ if (!username || !password) {
234
+ showMessage('loginMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
235
+ return;
236
+ }
237
+
238
  try {
239
  const response = await fetch(`${API_URL}/login`, {
240
  method: 'POST',
 
258
  showMessage('loginMessage', 'حدث خطأ في الاتصال', true);
259
  }
260
  }
261
+
262
  async function register() {
263
  const username = document.getElementById('registerUsername').value;
264
  const password = document.getElementById('registerPassword').value;
265
 
266
+ if (!username || !password) {
267
+ showMessage('registerMessage', 'الرجاء إدخال جميع البيانات المطلوبة', true);
268
+ return;
269
+ }
270
+
271
  try {
272
  const response = await fetch(`${API_URL}/register`, {
273
  method: 'POST',
 
283
  showMessage('registerMessage', data.message);
284
  document.getElementById('registerUsername').value = '';
285
  document.getElementById('registerPassword').value = '';
286
+ setTimeout(() => {
287
+ toggleForm();
288
+ }, 1500);
289
  } else {
290
  showMessage('registerMessage', data.detail, true);
291
  }
 
293
  showMessage('registerMessage', 'حدث خطأ في الاتصال', true);
294
  }
295
  }
296
+
297
+ // إضافة استجابة للضغط على Enter
298
+ document.querySelectorAll('input').forEach(input => {
299
+ input.addEventListener('keypress', (e) => {
300
+ if (e.key === 'Enter') {
301
+ const form = input.closest('.form-box');
302
+ if (form.classList.contains('login-form')) {
303
+ login();
304
+ } else {
305
+ register();
306
+ }
307
+ }
308
+ });
309
+ });
310
  </script>
311
  </body>
312
  </html>