| 
									
										
										
										
											2022-01-26 21:10:09 +08:00
										 |  |  | {% block body %} | 
					
						
							|  |  |  | {% if session['logged_in'] %} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-06-21 16:48:45 +08:00
										 |  |  | 你已登录 <a href="/{{ session['username'] }}/userpage">{{ session['username'] }}</a>。 登出点击<a href="/logout">这里</a>。 | 
					
						
							| 
									
										
										
										
											2022-01-26 21:10:09 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | {% else %} | 
					
						
							|  |  |  | <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=0.5, maximum-scale=3.0, user-scalable=yes" /> | 
					
						
							| 
									
										
										
										
											2022-12-03 20:52:01 +08:00
										 |  |  | <link rel="stylesheet" href="static/css/login_service.css"> | 
					
						
							| 
									
										
										
										
											2023-03-08 16:33:13 +08:00
										 |  |  | <script src="static/js/jquery.js"></script> | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  |     function login(){ | 
					
						
							|  |  |  |         let username = $("#username").val(); | 
					
						
							|  |  |  |         let password = $("#password").val(); | 
					
						
							|  |  |  |         if (username === "" || password === ""){ | 
					
						
							|  |  |  |             alert('输入不能为空!'); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-04-06 00:18:44 +08:00
										 |  |  |         if (password.includes(' ')) { | 
					
						
							|  |  |  |             alert('输入不能包含空格!'); | 
					
						
							|  |  |  |             return false; | 
					
						
							|  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-03-08 16:33:13 +08:00
										 |  |  |         $.post( | 
					
						
							|  |  |  |             "/login", {'username': username, 'password': password}, | 
					
						
							|  |  |  |             function (response) { | 
					
						
							|  |  |  |                 if (response.status === '0') { | 
					
						
							|  |  |  |                     alert('无法通过验证。'); | 
					
						
							|  |  |  |                     window.location.href = "/login"; | 
					
						
							|  |  |  |                 } else if (response.status === '1') { | 
					
						
							| 
									
										
										
										
											2023-04-20 20:30:14 +08:00
										 |  |  |                     window.location.href = "/"+username+"/userpage"; | 
					
						
							| 
									
										
										
										
											2023-03-08 16:33:13 +08:00
										 |  |  |                 } | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  |         ) | 
					
						
							|  |  |  |         return false; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | </script> | 
					
						
							| 
									
										
										
										
											2022-07-20 17:06:11 +08:00
										 |  |  | <div class="container"> | 
					
						
							| 
									
										
										
										
											2022-07-20 17:08:07 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-07-20 17:06:11 +08:00
										 |  |  |   <section class="signin-heading"> | 
					
						
							| 
									
										
										
										
											2023-08-11 19:32:34 +08:00
										 |  |  |     <h1>Sign in</h1> | 
					
						
							| 
									
										
										
										
											2022-07-20 17:06:11 +08:00
										 |  |  |   </section> | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-08 16:33:13 +08:00
										 |  |  |   <input type="text" placeholder="用户名" class="username" id="username"> | 
					
						
							|  |  |  |   <input type="password" placeholder="密码" class="password"  id="password"> | 
					
						
							|  |  |  |   <button type="button" class="btn" onclick="login()">登录</button> | 
					
						
							|  |  |  |   <a class="signup" href="/signup">注册</a> | 
					
						
							| 
									
										
										
										
											2022-07-20 17:07:09 +08:00
										 |  |  | </div> | 
					
						
							| 
									
										
										
										
											2022-07-20 17:08:07 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | {% endif %} | 
					
						
							|  |  |  | {% endblock %} | 
					
						
							| 
									
										
										
										
											2022-01-26 21:10:09 +08:00
										 |  |  | 
 |