(accountManager)
| 21 | * @return {Function} |
| 22 | */ |
| 23 | export function checkAccountExists (accountManager) { |
| 24 | return (req, res, next) => { |
| 25 | const accountUri = req.hostname |
| 26 | |
| 27 | accountManager.accountUriExists(accountUri) |
| 28 | .then(found => { |
| 29 | if (!found) { |
| 30 | debugAccounts(`Account ${accountUri} is available (for ${req.originalUrl})`) |
| 31 | return res.sendStatus(404) |
| 32 | } |
| 33 | debugAccounts(`Account ${accountUri} is not available (for ${req.originalUrl})`) |
| 34 | next() |
| 35 | }) |
| 36 | .catch(next) |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * Returns an Express middleware handler for adding a new certificate to an |
no test coverage detected