forked from mozilla/blurts-server
-
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.
Reroute and update breach details pages. WIP.
- Loading branch information
1 parent
9926ada
commit 03a3714
Showing
5 changed files
with
46 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
"use strict"; | ||
|
||
const HIBP = require("../hibp"); | ||
|
||
function getBreachDetail(req, res) { | ||
|
||
const allBreaches = req.app.locals.breaches; | ||
|
||
const breachName = req.params.breachName; | ||
const featuredBreach = HIBP.getBreachByName(allBreaches, breachName); | ||
|
||
if (!featuredBreach) { | ||
res.redirect("/"); | ||
} | ||
|
||
res.render("breach-detail", { | ||
featuredBreach, | ||
}); | ||
} | ||
|
||
module.exports = { | ||
getBreachDetail, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
"use strict"; | ||
|
||
const express = require("express"); | ||
const { getBreachDetail } = require("../controllers/breach-details"); | ||
const router = express.Router(); | ||
|
||
|
||
router.get("/:breachName", getBreachDetail); | ||
|
||
module.exports = router; |
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