@lexho111/plainblog 0.2.6 → 0.2.7
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/Blog.js +12 -6
- package/Formatter.js +1 -0
- package/package.json +1 -1
package/Blog.js
CHANGED
|
@@ -113,9 +113,12 @@ export default class Blog {
|
|
|
113
113
|
res.end();
|
|
114
114
|
} else {
|
|
115
115
|
res.writeHead(401, { "Content-Type": "text/html" });
|
|
116
|
-
res.end(`<style>${this.styles}</style
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
res.end(`<html><head><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>${this.styles}</style></head>
|
|
117
|
+
<body>
|
|
118
|
+
<h1>Unauthorized</h1><p>Please enter the password.<form method="POST">
|
|
119
|
+
<input type="password" name="password" placeholder="Password" />
|
|
120
|
+
<button style="margin: 2px;">Login</button></form>
|
|
121
|
+
</body></html>`);
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
|
|
@@ -214,9 +217,12 @@ export default class Blog {
|
|
|
214
217
|
if (req.url === "/login") {
|
|
215
218
|
if (req.method === "GET") {
|
|
216
219
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
217
|
-
res.end(`<style>${this.styles}</style
|
|
218
|
-
|
|
219
|
-
|
|
220
|
+
res.end(`<html><head><meta name="viewport" content="width=device-width, initial-scale=1.0"><style>${this.styles}</style></head>
|
|
221
|
+
<body>
|
|
222
|
+
<h1>Login</h1><form method="POST">
|
|
223
|
+
<input type="password" name="password" placeholder="Password" />
|
|
224
|
+
<button style="margin: 2px;">Login</button></form>
|
|
225
|
+
</body></html>`);
|
|
220
226
|
return;
|
|
221
227
|
} else if (req.method === "POST") {
|
|
222
228
|
await this.handleLogin(req, res);
|
package/Formatter.js
CHANGED