hono-sessions 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -34
- package/package.json +3 -9
package/README.md
CHANGED
|
@@ -35,9 +35,9 @@ const sessionRoutes = new Hono<{
|
|
|
35
35
|
}
|
|
36
36
|
}>()
|
|
37
37
|
|
|
38
|
-
sessionRoutes.use('*',
|
|
38
|
+
sessionRoutes.use('*', sessionMiddleware({
|
|
39
39
|
store,
|
|
40
|
-
expireAfterSeconds: 900 // delete session after 15 minutes of inactivity
|
|
40
|
+
expireAfterSeconds: 900, // delete session after 15 minutes of inactivity
|
|
41
41
|
encryptionKey: 'password_that_is_at_least_32_characters_long' // Required while using CookieStore. Please use a secure, un-guessable password!
|
|
42
42
|
}))
|
|
43
43
|
|
|
@@ -75,38 +75,32 @@ sessionRoutes.get('/', (c) => {
|
|
|
75
75
|
|
|
76
76
|
return c.html(`<!DOCTYPE html>
|
|
77
77
|
<html lang="en">
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<p>
|
|
105
|
-
<input id="password" name="password" type="password" placeholder="password">
|
|
106
|
-
</p>
|
|
107
|
-
<button name="login" type="submit">Log in</button>
|
|
108
|
-
</form>`
|
|
109
|
-
}
|
|
78
|
+
<head>
|
|
79
|
+
<meta charset="UTF-8">
|
|
80
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
81
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
82
|
+
<title>Hono Sessions</title>
|
|
83
|
+
</head>
|
|
84
|
+
<body>
|
|
85
|
+
<p>${message}</p>
|
|
86
|
+
<p>${error}</p>
|
|
87
|
+
<p>${failedLoginAttempts ? `Failed login attempts: ${failedLoginAttempts}` : ''}</p>
|
|
88
|
+
|
|
89
|
+
${email ?
|
|
90
|
+
`<form id="logout" action="/logout" method="post">
|
|
91
|
+
<button name="logout" type="submit">Log out ${email}</button>
|
|
92
|
+
</form>`
|
|
93
|
+
:
|
|
94
|
+
`<form id="login" action="/login" method="post">
|
|
95
|
+
<p>
|
|
96
|
+
<input id="email" name="email" type="text" placeholder="you@email.com">
|
|
97
|
+
</p>
|
|
98
|
+
<p>
|
|
99
|
+
<input id="password" name="password" type="password" placeholder="password">
|
|
100
|
+
</p>
|
|
101
|
+
<button name="login" type="submit">Log in</button>
|
|
102
|
+
</form>`
|
|
103
|
+
}
|
|
110
104
|
</body>
|
|
111
105
|
</html>`)
|
|
112
106
|
})
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"module": "./esm/mod.js",
|
|
3
3
|
"main": "./script/mod.js",
|
|
4
4
|
"name": "hono-sessions",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.4",
|
|
6
6
|
"description": "Cookie-based sessions for Hono web framework",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|
|
@@ -18,15 +18,9 @@
|
|
|
18
18
|
"require": "./script/mod.js"
|
|
19
19
|
}
|
|
20
20
|
},
|
|
21
|
-
"scripts": {
|
|
22
|
-
"test": "node test_runner.js"
|
|
23
|
-
},
|
|
24
21
|
"dependencies": {
|
|
25
|
-
"hono": "
|
|
26
|
-
"iron-webcrypto": "0.
|
|
22
|
+
"hono": "3.5.8",
|
|
23
|
+
"iron-webcrypto": "0.10.1",
|
|
27
24
|
"nanoid": "4.0.0"
|
|
28
|
-
},
|
|
29
|
-
"devDependencies": {
|
|
30
|
-
"picocolors": "^1.0.0"
|
|
31
25
|
}
|
|
32
26
|
}
|