Skip to content

Commit db5787a

Browse files
committed
Rename heading
Prevent confusion with POST as an HTTP verb
1 parent 9c5f8a2 commit db5787a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

nodeJS/authentication/session_based_authentication.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ And edit the homepage to show a personalized greeting with a logout button (whic
275275
</html>
276276
```
277277
278-
### Handling post-login requests
278+
### Handling requests after login
279279
280280
As of now, our `GET /` route will always display the homepage and will crash if someone has not yet logged in! There would not be a cookie and therefore no session to deserialize, so `req.session` would contain a fresh session object without any user properties. We can write a middleware that checks `req.session` and if it has a user ID in it, we can use it to query the db and grab any user info we need, then continue to the homepage. Otherwise, the user is not authenticated and we can redirect to the login page.
281281
@@ -368,7 +368,7 @@ app.post("/signup", async (req, res, next) => {
368368
});
369369
```
370370
371-
We don't need to modify any of its options, as the defaults all meet the [password storage recommendations set by OWASP](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#introduction) (Open Worldwide Application Security Project). Now in our `POST /login` middleware, we can also use argon2 to verify the submitted password against the stored salted hash.
371+
We don't need to modify any of its options, as the defaults all meet the [password storage recommendations set by OWASP](https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html#introduction) (Open Worldwide Application Security Project). Now in our `POST /login` middleware, we can also use argon2 to verify the submitted password against the stored salted hash:
372372
373373
```javascript
374374
app.post("/login", async (req, res, next) => {
@@ -432,7 +432,7 @@ The following questions are an opportunity to reflect on key topics in this less
432432
- [What library can we use in Express to implement sessions?](#implementing-sessions)
433433
- [Why do we need to set a session secret?](#session-secret)
434434
- [How should the server respond if a user successfully logs in?](#logging-in)
435-
- [After a user has logged in, how can the server recognize them for future requests?](#handling-post-login-requests)
435+
- [After a user has logged in, how can the server recognize them for future requests?](#handling-requests-after-login)
436436
- [What should the server do to "log a user out"?](#logging-out)
437437
- [If we are to store passwords in our database, how can we ensure secure storage?](#storing-passwords-securely)
438438
- [Should passwords be encrypted for storage and why/why not?](#storing-passwords-securely)

0 commit comments

Comments
 (0)