Gitlab@Informatics

Skip to content
Snippets Groups Projects
Commit bdabf532 authored by 65160381's avatar 65160381
Browse files

7.6

parent 3c5eccb9
No related branches found
No related tags found
No related merge requests found
Pipeline #595 passed with warnings
......@@ -68,6 +68,8 @@ app.get('/register', (req, res) => {
res.sendFile(path.join(__dirname, 'public', 'register.html'));
});
app.post('/register', async (req, res) => {
const { email, password } = req.body;
......@@ -142,6 +144,10 @@ app.post('/login', async (req, res) => {
}
});
app.use(express.json()); // สำหรับการ parse ข้อมูลแบบ JSON
app.use(express.urlencoded({ extended: true })); // สำหรับการ parse ข้อมูลแบบ URL-encoded
app.post('/logout', (req, res) => {
req.session.destroy(err => {
if (err) {
......
......@@ -9,9 +9,9 @@
<body>
<div class="login-container">
<h2>Login</h2>
<form action="/login" method="post">
<input type="text" placeholder="Username" name="user" required>
<input type="password" placeholder="Password" name="password" required>
<form method="POST" action="/login">
<input type="email" placeholder="Email" name="email" required />
<input type="password" placeholder="Password" name="password" required />
<button type="submit">Login</button>
<p>don't have account <a href="register.html">Register</a></p>
</form>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment