cjian2025 commited on
Commit
525988c
·
verified ·
1 Parent(s): d322027

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +302 -19
index.html CHANGED
@@ -1,19 +1,302 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="zh-Hant">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>精緻化系統登入</title>
7
+ <style>
8
+ @import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@400;700&display=swap');
9
+
10
+ body {
11
+ font-family: 'Noto Sans TC', Arial, sans-serif;
12
+ margin: 0;
13
+ padding: 0;
14
+ display: flex;
15
+ justify-content: center;
16
+ align-items: center;
17
+ min-height: 100vh;
18
+ background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
19
+ color: #333;
20
+ overflow: hidden;
21
+ }
22
+
23
+ .main-container {
24
+ width: 100%;
25
+ height: 100vh;
26
+ display: flex;
27
+ justify-content: center;
28
+ align-items: center;
29
+ transition: all 0.5s ease-in-out;
30
+ padding: 20px;
31
+ box-sizing: border-box;
32
+ }
33
+
34
+ .login-form-container {
35
+ background-color: #ffffff;
36
+ padding: 50px;
37
+ border-radius: 20px;
38
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
39
+ width: 450px;
40
+ text-align: center;
41
+ animation: fadeIn 1s ease-in-out;
42
+ }
43
+
44
+ .login-form-container h2 {
45
+ margin-bottom: 35px;
46
+ color: #4a4a4a;
47
+ font-size: 32px;
48
+ font-weight: 700;
49
+ }
50
+
51
+ .form-group {
52
+ margin-bottom: 25px;
53
+ text-align: left;
54
+ }
55
+
56
+ .form-group label {
57
+ display: block;
58
+ margin-bottom: 10px;
59
+ color: #666;
60
+ font-size: 16px;
61
+ font-weight: bold;
62
+ }
63
+
64
+ .form-group input {
65
+ width: 100%;
66
+ padding: 15px;
67
+ box-sizing: border-box;
68
+ border: 1px solid #e0e0e0;
69
+ border-radius: 10px;
70
+ font-size: 16px;
71
+ transition: border-color 0.3s, box-shadow 0.3s;
72
+ }
73
+
74
+ .form-group input:focus {
75
+ outline: none;
76
+ border-color: #8c7ae6;
77
+ box-shadow: 0 0 0 3px rgba(140, 122, 230, 0.2);
78
+ }
79
+
80
+ .captcha-container {
81
+ display: flex;
82
+ align-items: center;
83
+ justify-content: space-between;
84
+ }
85
+
86
+ .captcha-container input {
87
+ flex: 1;
88
+ margin-right: 15px;
89
+ }
90
+
91
+ .captcha-code {
92
+ font-family: 'Courier New', Courier, monospace;
93
+ font-size: 32px;
94
+ font-weight: bold;
95
+ color: #d9534f;
96
+ background-color: #fcebeb;
97
+ padding: 10px 20px;
98
+ border: 2px dashed #e74c3c;
99
+ border-radius: 10px;
100
+ letter-spacing: 15px;
101
+ cursor: pointer;
102
+ user-select: none;
103
+ }
104
+
105
+ .captcha-code:hover {
106
+ opacity: 0.8;
107
+ }
108
+
109
+ button {
110
+ width: 100%;
111
+ padding: 15px;
112
+ background: linear-gradient(45deg, #6c5ce7, #8c7ae6);
113
+ color: white;
114
+ border: none;
115
+ border-radius: 10px;
116
+ cursor: pointer;
117
+ font-size: 18px;
118
+ font-weight: bold;
119
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
120
+ transition: transform 0.3s, box-shadow 0.3s;
121
+ }
122
+
123
+ button:hover {
124
+ transform: translateY(-3px);
125
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
126
+ }
127
+
128
+ .iframe-container {
129
+ position: relative;
130
+ width: 100%;
131
+ height: 100vh;
132
+ display: flex;
133
+ flex-direction: column;
134
+ justify-content: center;
135
+ align-items: center;
136
+ animation: slideIn 1s ease-in-out forwards;
137
+ }
138
+
139
+ .iframe-wrapper {
140
+ width: 95%;
141
+ height: 90%;
142
+ border-radius: 15px;
143
+ overflow: hidden;
144
+ box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
145
+ }
146
+
147
+ iframe {
148
+ width: 100%;
149
+ height: 100%;
150
+ border: none;
151
+ }
152
+
153
+ .back-button {
154
+ position: absolute;
155
+ top: 30px;
156
+ left: 30px;
157
+ padding: 12px 20px;
158
+ background-color: #6c757d;
159
+ color: white;
160
+ border: none;
161
+ border-radius: 8px;
162
+ cursor: pointer;
163
+ font-size: 16px;
164
+ z-index: 10;
165
+ box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
166
+ transition: background-color 0.3s, transform 0.3s;
167
+ }
168
+
169
+ .back-button:hover {
170
+ background-color: #5a6268;
171
+ transform: translateY(-2px);
172
+ }
173
+
174
+ .hidden {
175
+ display: none;
176
+ }
177
+
178
+ @keyframes fadeIn {
179
+ from { opacity: 0; transform: translateY(20px); }
180
+ to { opacity: 1; transform: translateY(0); }
181
+ }
182
+
183
+ @keyframes slideIn {
184
+ from { transform: scale(0.95); opacity: 0; }
185
+ to { transform: scale(1); opacity: 1; }
186
+ }
187
+ </style>
188
+ </head>
189
+ <body>
190
+
191
+ <div class="main-container">
192
+ <div id="login-form-area">
193
+ <div class="login-form-container">
194
+ <h2>系統登入</h2>
195
+ <form id="login-form">
196
+ <div class="form-group">
197
+ <label for="username">帳號</label>
198
+ <input type="text" id="username" name="username" required placeholder="請輸入帳號">
199
+ </div>
200
+ <div class="form-group">
201
+ <label for="password">密碼</label>
202
+ <input type="password" id="password" name="password" required placeholder="請輸入密碼">
203
+ </div>
204
+ <div class="form-group">
205
+ <label for="captcha">驗證碼</label>
206
+ <div class="captcha-container">
207
+ <input type="text" id="captcha" name="captcha" required placeholder="請輸入驗證碼">
208
+ <span id="captcha-code" class="captcha-code" title="點擊重新整理"></span>
209
+ </div>
210
+ </div>
211
+ <button type="submit">登入</button>
212
+ </form>
213
+ </div>
214
+ </div>
215
+
216
+ <div id="iframe-area" class="iframe-container hidden">
217
+ <button id="back-to-login-button" class="back-button">回到登入頁</button>
218
+ <div class="iframe-wrapper">
219
+ <iframe
220
+ id="content-iframe"
221
+ src="https://cjian2025-systememail.hf.space"
222
+ frameborder="0"
223
+ ></iframe>
224
+ </div>
225
+ </div>
226
+ </div>
227
+
228
+ <script>
229
+ document.addEventListener('DOMContentLoaded', () => {
230
+ const loginForm = document.getElementById('login-form');
231
+ const usernameInput = document.getElementById('username');
232
+ const passwordInput = document.getElementById('password');
233
+ const captchaInput = document.getElementById('captcha');
234
+ const captchaCodeSpan = document.getElementById('captcha-code');
235
+ const loginFormArea = document.getElementById('login-form-area');
236
+ const iframeArea = document.getElementById('iframe-area');
237
+ const backToLoginButton = document.getElementById('back-to-login-button');
238
+
239
+ function generateCaptcha() {
240
+ const chars = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
241
+ let captcha = '';
242
+ for (let i = 0; i < 6; i++) {
243
+ captcha += chars.charAt(Math.floor(Math.random() * chars.length));
244
+ }
245
+ captchaCodeSpan.textContent = captcha;
246
+ }
247
+
248
+ async function hashString(str) {
249
+ const textEncoder = new TextEncoder();
250
+ const data = textEncoder.encode(str);
251
+ const hashBuffer = await crypto.subtle.digest('SHA-256', data);
252
+ const hashArray = Array.from(new Uint8Array(hashBuffer));
253
+ const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
254
+ return hashHex;
255
+ }
256
+
257
+ generateCaptcha();
258
+ captchaCodeSpan.addEventListener('click', generateCaptcha);
259
+
260
+ loginForm.addEventListener('submit', async (e) => {
261
+ e.preventDefault();
262
+
263
+ const correctUsername = 'ROOT2025';
264
+ const correctPassword = '123456';
265
+ const correctCaptcha = captchaCodeSpan.textContent;
266
+
267
+ const userUsername = usernameInput.value;
268
+ const userPassword = passwordInput.value;
269
+ const userCaptcha = captchaInput.value;
270
+
271
+ if (userCaptcha.toUpperCase() !== correctCaptcha.toUpperCase()) {
272
+ alert('驗證碼錯誤!');
273
+ generateCaptcha();
274
+ return;
275
+ }
276
+
277
+ const hashedUsername = await hashString(userUsername);
278
+ const hashedCorrectUsername = await hashString(correctUsername);
279
+
280
+ const hashedUserPassword = await hashString(userPassword);
281
+ const hashedCorrectPassword = await hashString(correctPassword);
282
+
283
+ if (hashedUsername === hashedCorrectUsername && hashedUserPassword === hashedCorrectPassword) {
284
+ alert('登入成功!');
285
+ loginFormArea.classList.add('hidden');
286
+ iframeArea.classList.remove('hidden');
287
+ } else {
288
+ alert('帳號或密碼錯誤!');
289
+ generateCaptcha();
290
+ }
291
+ });
292
+
293
+ backToLoginButton.addEventListener('click', () => {
294
+ loginFormArea.classList.remove('hidden');
295
+ iframeArea.classList.add('hidden');
296
+ loginForm.reset();
297
+ generateCaptcha();
298
+ });
299
+ });
300
+ </script>
301
+ </body>
302
+ </html>