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:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user