-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
71 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
"bcryptjs": "^2.4.3", | ||
"body-parser": "^1.20.2", | ||
"connect-mongodb-session": "^5.0.0", | ||
"csurf": "^1.11.0", | ||
This comment has been minimized.
Sorry, something went wrong.
leo41271
Author
Owner
|
||
"ejs": "^3.1.9", | ||
"express": "^4.19.2", | ||
"express-session": "^1.18.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
<input type="hidden" value="<%= product._id %>" name="productId"> | ||
<% } %> | ||
|
||
<input type="hidden" name="_csrf" value="<%= csrfToken %>" /> | ||
This comment has been minimized.
Sorry, something went wrong.
leo41271
Author
Owner
|
||
<button class="btn" type="submit"><% if (editing) { %>Update Product<% } else { %>Add Product<% } %></button> | ||
</form> | ||
</main> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<form action="/cart" method="post"> | ||
<button class="btn" type="submit">Add to Cart</button> | ||
<input type="hidden" name="productId" value="<%= product._id %>"> | ||
</form> | ||
<input type="hidden" name="_csrf" value="<%= csrfToken %>" /> | ||
<input type="hidden" name="productId" value="<%= product._id %>" /> | ||
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CSRF 攻击和防御 - Web 安全常识
csurf Example (npm but package is deprecated)