Skip to content

Commit aafd32b

Browse files
committed
Add user authentication features, including login API and session management
- Implemented `AuthManager` for user session handling and authentication. - Added login request and response schemas. - Created login page with user interface for authentication. - Updated dependencies in `Cargo.toml` and `Cargo.lock`. - Enhanced error handling and session status management.
1 parent 199a5de commit aafd32b

File tree

14 files changed

+600
-42
lines changed

14 files changed

+600
-42
lines changed

Cargo.lock

Lines changed: 82 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ edition = "2024"
66
[dependencies]
77
env_logger = "0.11.8"
88
chrono = "0.4.41"
9-
kurosabi = "0.2.8"
9+
kurosabi = "0.2.9"
1010
tokio = { version = "1.45.0", features = ["full"] }
1111
serde_json = "1.0.140"
1212
serde = { version = "1.0.219", features = ["derive"] }
13+
dashmap = "6.1.0"
14+
rand = "0.8.0" # 0.9はだめ
15+
base64 = "0.22.1"
1316

data/pages/index/login/index.html

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<!DOCTYPE html>
2+
<html lang="jp">
3+
4+
<head>
5+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
6+
<link rel="icon" href="/favicon.ico">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<meta name="description" content="371tti.net">
9+
<meta property="og:description" content="371tti.net license">
10+
<meta property="og:title" content="371tti.net">
11+
<meta property="og:type" content="article">
12+
<meta property="og:url" content="/license">
13+
<title>License - 371tti.net</title>
14+
<link rel="stylesheet" href="/style.css">
15+
</head>
16+
<body>
17+
18+
19+
<script src="/box-load-anime.js"></script>
20+
21+
<link rel="stylesheet" href="/modern-border.css">
22+
<script src="/modern-border.js"></script>
23+
24+
<div class="full center center-middle">
25+
<div class="main card grid-2" id="content">
26+
<div class="box r1">
27+
<div class="box">
28+
<div class="flex block-m">
29+
<h1>Login</h1>
30+
<div class="block subtitle">
31+
<h2>371tti.net</h2>
32+
</div>
33+
</div>
34+
</div>
35+
<hr>
36+
<div class="box">
37+
<p id="info">Enter to get 371tti.net service</p>
38+
<div class="flex-column">
39+
<input type="text" id="username" name="username" placeholder="username" required>
40+
</div>
41+
<div class="flex-column">
42+
<input type="password" id="password" name="password" autocomplete="current-password" placeholder="password" required>
43+
</div>
44+
<div class="pd"></div>
45+
<div class="button right" id="login_button">
46+
<p>login</p>
47+
</div>
48+
</div>
49+
</div>
50+
<div class="box indent r1">
51+
<h2 >select account</h2>
52+
<div class="pd"></div>
53+
<div class="flex">
54+
<div class="user-icon" style="height: 12mm;">
55+
<img src="/371tti_icon.png" alt="371tti" style="height: 100%; width: 100%;">
56+
</div>
57+
<div class="flex-column">
58+
<h3>@371tti</h3>
59+
<p>session time out</p>
60+
</div>
61+
</div>
62+
<div class="flex">
63+
<div class="user-icon" style="height: 12mm;">
64+
<img src="/371tti_icon.png" alt="371tti" style="height: 100%; width: 100%;">
65+
</div>
66+
<div class="flex-column">
67+
<h3>@371tti.clone()</h3>
68+
<p>session time out</p>
69+
</div>
70+
</div>
71+
<div class="flex">
72+
<div class="user-icon" style="height: 12mm;">
73+
<img src="/371tti_icon.png" alt="371tti" style="height: 100%; width: 100%;">
74+
</div>
75+
<div class="flex-column">
76+
<h3>@371tti.copy()</h3>
77+
<p>session time out</p>
78+
</div>
79+
</div>
80+
</div>
81+
82+
</div>
83+
84+
</div>
85+
86+
<p class="center">© 2024~ 371tti</p>
87+
<p class="center"><a href="/">top_page</a> - <a href="/terms">terms</a></p>
88+
</body>
89+
<script>
90+
document.getElementById("login_button").onclick = function() {
91+
var username = document.getElementById("username").value;
92+
var password = document.getElementById("password").value;
93+
var info = document.getElementById("info");
94+
95+
if (username === "" || password === "") {
96+
info.innerHTML = "Please fill in all fields.";
97+
return;
98+
}
99+
100+
// Simulate a login process
101+
if (username === "371tti" && password === "371tti") {
102+
info.innerHTML = "Login successful! Redirecting...";
103+
setTimeout(function() {
104+
window.location.href = "/index";
105+
}, 2000);
106+
} else {
107+
info.innerHTML = "Invalid username or password.";
108+
}
109+
};
110+
</script>
111+
</html>

0 commit comments

Comments
 (0)