1
0
mirror of https://github.com/kamranahmedse/developer-roadmap.git synced 2025-08-20 08:02:35 +02:00

Reformat session based authentication code samples

This commit is contained in:
Kamran Ahmed
2022-11-01 18:00:25 +04:00
parent 9727a3daae
commit a70739bc4a

View File

@@ -85,9 +85,9 @@ module.exports = function HomeHandler(req, res) {
res.setHeader('Content-Type', 'text/HTML)
res.write(`
<h1>Welcome back ${req.session.userid}</h1>
<a href="/logout">Logout</a>
`);
<h1>Welcome back ${req.session.userid}</h1>
<a href="/logout">Logout</a>
`);
res.end()
}
@@ -113,13 +113,13 @@ module.exports = function LoginHandler(req, res) {
res.setHeader('Content-Type', 'text/HTML)
res.write(`
<h1>Login</h1>
<form method="post" action="/process-login">
<input type="text" name="username" placeholder="Username" /> <br>
<input type="password" name="password" placeholder="Password" /> <br>
<button type="submit">Login</button>
</form>
`);
<h1>Login</h1>
<form method="post" action="/process-login">
<input type="text" name="username" placeholder="Username" /> <br>
<input type="password" name="password" placeholder="Password" /> <br>
<button type="submit">Login</button>
</form>
`);
res.end();
}