Skip to content

Commit

Permalink
for mozilla#247: rename "db" to "DB"
Browse files Browse the repository at this point in the history
  • Loading branch information
groovecoder committed Aug 3, 2018
1 parent 4760b62 commit 3c32120
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 7 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion routes/hibp.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const bodyParser = require("body-parser");
const router = express.Router();
const jsonParser = bodyParser.json();

const DB = require("../db/db");
const DB = require("../db/DB");

router.post("/notify", jsonParser, async (req, res) => {
try {
Expand Down
2 changes: 1 addition & 1 deletion routes/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const express = require("express");
const got = require("got");
const bodyParser = require("body-parser");

const DB = require("../db/db");
const DB = require("../db/DB");

// This object exists instead of inlining the env vars to make it easy
// to abstract fetching API endpoints from the OAuth server (instead
Expand Down
2 changes: 1 addition & 1 deletion routes/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const AppConstants = require("../app-constants");
const express = require("express");
const bodyParser = require("body-parser");

const DB = require("../db/db");
const DB = require("../db/DB");
const EmailUtils = require("../email-utils");

const ResponseCodes = Object.freeze({
Expand Down
11 changes: 7 additions & 4 deletions scripts/notify-subscribers-of-breach.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
"use strict";

const DBUtils = require("../db/DB");
const EmailUtils = require("../email-utils");


const breachName = process.argv[2];
if (!breachName) {
throw("Usage: node notify-subscribers-of-breach.js \"breach-name\"");
}

const DBUtils = require("../db/db");
const EmailUtils = require("../email-utils");


EmailUtils.init();


async function notifySubscribersOfNewBreach(breachName) {
// FIXME: TODO: change to load breaches from HIBP
const breach = await DBUtils.getBreachByName(breachName);
console.log("Found breach: ", breach);
// FIXME: TODO: change to updated DB module code
const breachedSubscribers = await DBUtils.getSubscribersForBreach(breach);
console.log(`Found ${breachedSubscribers.length} un-notified subscribers in the breach`);
for (const subscriber of breachedSubscribers) {
Expand All @@ -29,6 +31,7 @@ async function notifySubscribersOfNewBreach(breachName) {
);
console.log("DONE sending email.");
console.log("Setting notified=true ...");
// FIXME: TODO: change to updated DB module code
await DBUtils.setBreachedHashNotified(breach, subscriber.email);
console.log("DONE setting notified=true");
} catch (e) {
Expand Down

0 comments on commit 3c32120

Please sign in to comment.