From 00629ef5b3335d55be686f7319ee3275d82878c1 Mon Sep 17 00:00:00 2001 From: zg009 Date: Fri, 15 Mar 2024 12:46:31 -0500 Subject: [PATCH] fix issue 1770:changed error handling of attempting to send passwork reset on nonexistent user: view issue 1770 --- lib/requests/password-reset-email-request.js | 11 +- package-lock.json | 216 +----------------- .../unit/password-reset-email-request-test.js | 37 ++- 3 files changed, 51 insertions(+), 213 deletions(-) diff --git a/lib/requests/password-reset-email-request.js b/lib/requests/password-reset-email-request.js index a4e40c33a..af5715b85 100644 --- a/lib/requests/password-reset-email-request.js +++ b/lib/requests/password-reset-email-request.js @@ -93,6 +93,13 @@ class PasswordResetEmailRequest extends AuthRequest { return Promise.resolve() .then(() => request.validate()) .then(() => request.loadUser()) + .catch((err) => { + if (err.code === "ACCOUNT_MISSING") { + this.response.render('auth/reset-link-sent') + } else { + return err; + } + }) .then(userAccount => request.sendResetLink(userAccount)) .then(() => request.renderSuccess()) .catch(error => request.error(error)) @@ -123,7 +130,9 @@ class PasswordResetEmailRequest extends AuthRequest { return this.accountManager.accountExists(username) .then(exists => { if (!exists) { - throw new Error('Account not found for that username') + const error = new Error("Account not found for that username") + error.code = "ACCOUNT_MISSING" + throw error } const userData = { username } diff --git a/package-lock.json b/package-lock.json index d3e9687e7..ca4a8795f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16706,28 +16706,25 @@ }, "node_modules/npm/node_modules/@colors/colors": { "version": "1.5.0", - "extraneous": true, "inBundle": true, "license": "MIT", + "optional": true, "engines": { "node": ">=0.1.90" } }, "node_modules/npm/node_modules/@gar/promisify": { "version": "1.1.3", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/@isaacs/string-locale-compare": { "version": "1.1.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/arborist": { "version": "5.6.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16778,7 +16775,6 @@ }, "node_modules/npm/node_modules/@npmcli/ci-detect": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -16787,7 +16783,6 @@ }, "node_modules/npm/node_modules/@npmcli/config": { "version": "4.2.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16806,7 +16801,6 @@ }, "node_modules/npm/node_modules/@npmcli/disparity-colors": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16818,7 +16812,6 @@ }, "node_modules/npm/node_modules/@npmcli/fs": { "version": "2.1.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16831,7 +16824,6 @@ }, "node_modules/npm/node_modules/@npmcli/git": { "version": "3.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16851,7 +16843,6 @@ }, "node_modules/npm/node_modules/@npmcli/installed-package-contents": { "version": "1.0.7", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16867,7 +16858,6 @@ }, "node_modules/npm/node_modules/@npmcli/installed-package-contents/node_modules/npm-bundled": { "version": "1.1.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16876,7 +16866,6 @@ }, "node_modules/npm/node_modules/@npmcli/map-workspaces": { "version": "2.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16891,7 +16880,6 @@ }, "node_modules/npm/node_modules/@npmcli/metavuln-calculator": { "version": "3.1.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16906,7 +16894,6 @@ }, "node_modules/npm/node_modules/@npmcli/move-file": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -16919,13 +16906,11 @@ }, "node_modules/npm/node_modules/@npmcli/name-from-folder": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/@npmcli/node-gyp": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -16934,7 +16919,6 @@ }, "node_modules/npm/node_modules/@npmcli/package-json": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16946,7 +16930,6 @@ }, "node_modules/npm/node_modules/@npmcli/promise-spawn": { "version": "3.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16958,7 +16941,6 @@ }, "node_modules/npm/node_modules/@npmcli/query": { "version": "1.2.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16972,7 +16954,6 @@ }, "node_modules/npm/node_modules/@npmcli/run-script": { "version": "4.2.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -16988,7 +16969,6 @@ }, "node_modules/npm/node_modules/@tootallnate/once": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -16997,13 +16977,11 @@ }, "node_modules/npm/node_modules/abbrev": { "version": "1.1.1", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/agent-base": { "version": "6.0.2", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17015,7 +16993,6 @@ }, "node_modules/npm/node_modules/agentkeepalive": { "version": "4.2.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17029,7 +17006,6 @@ }, "node_modules/npm/node_modules/aggregate-error": { "version": "3.1.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17042,7 +17018,6 @@ }, "node_modules/npm/node_modules/ansi-regex": { "version": "5.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17051,7 +17026,6 @@ }, "node_modules/npm/node_modules/ansi-styles": { "version": "4.3.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17066,19 +17040,16 @@ }, "node_modules/npm/node_modules/aproba": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/archy": { "version": "1.0.0", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/are-we-there-yet": { "version": "3.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17091,19 +17062,16 @@ }, "node_modules/npm/node_modules/asap": { "version": "2.0.6", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/balanced-match": { "version": "1.0.2", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/bin-links": { "version": "3.0.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17120,7 +17088,6 @@ }, "node_modules/npm/node_modules/bin-links/node_modules/npm-normalize-package-bin": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -17129,7 +17096,6 @@ }, "node_modules/npm/node_modules/binary-extensions": { "version": "2.2.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17138,7 +17104,6 @@ }, "node_modules/npm/node_modules/brace-expansion": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17147,7 +17112,6 @@ }, "node_modules/npm/node_modules/builtins": { "version": "5.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17156,7 +17120,6 @@ }, "node_modules/npm/node_modules/cacache": { "version": "16.1.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17185,7 +17148,6 @@ }, "node_modules/npm/node_modules/chalk": { "version": "4.1.2", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17201,7 +17163,6 @@ }, "node_modules/npm/node_modules/chownr": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -17210,7 +17171,6 @@ }, "node_modules/npm/node_modules/cidr-regex": { "version": "3.1.1", - "extraneous": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -17222,7 +17182,6 @@ }, "node_modules/npm/node_modules/clean-stack": { "version": "2.2.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17231,7 +17190,6 @@ }, "node_modules/npm/node_modules/cli-columns": { "version": "4.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17244,7 +17202,6 @@ }, "node_modules/npm/node_modules/cli-table3": { "version": "0.6.2", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17259,7 +17216,6 @@ }, "node_modules/npm/node_modules/clone": { "version": "1.0.4", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17268,7 +17224,6 @@ }, "node_modules/npm/node_modules/cmd-shim": { "version": "5.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17280,7 +17235,6 @@ }, "node_modules/npm/node_modules/color-convert": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17292,13 +17246,11 @@ }, "node_modules/npm/node_modules/color-name": { "version": "1.1.4", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/color-support": { "version": "1.1.3", - "extraneous": true, "inBundle": true, "license": "ISC", "bin": { @@ -17307,7 +17259,6 @@ }, "node_modules/npm/node_modules/columnify": { "version": "1.6.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17320,25 +17271,21 @@ }, "node_modules/npm/node_modules/common-ancestor-path": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/concat-map": { "version": "0.0.1", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/console-control-strings": { "version": "1.1.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/cssesc": { "version": "3.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "bin": { @@ -17350,7 +17297,6 @@ }, "node_modules/npm/node_modules/debug": { "version": "4.3.4", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17367,13 +17313,11 @@ }, "node_modules/npm/node_modules/debug/node_modules/ms": { "version": "2.1.2", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/debuglog": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17382,7 +17326,6 @@ }, "node_modules/npm/node_modules/defaults": { "version": "1.0.3", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17391,13 +17334,11 @@ }, "node_modules/npm/node_modules/delegates": { "version": "1.0.0", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/depd": { "version": "1.1.2", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17406,7 +17347,6 @@ }, "node_modules/npm/node_modules/dezalgo": { "version": "1.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17416,7 +17356,6 @@ }, "node_modules/npm/node_modules/diff": { "version": "5.1.0", - "extraneous": true, "inBundle": true, "license": "BSD-3-Clause", "engines": { @@ -17425,22 +17364,20 @@ }, "node_modules/npm/node_modules/emoji-regex": { "version": "8.0.0", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/encoding": { "version": "0.1.13", - "extraneous": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "iconv-lite": "^0.6.2" } }, "node_modules/npm/node_modules/env-paths": { "version": "2.2.1", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17449,19 +17386,16 @@ }, "node_modules/npm/node_modules/err-code": { "version": "2.0.3", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/fastest-levenshtein": { "version": "1.0.12", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/fs-minipass": { "version": "2.1.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17473,19 +17407,16 @@ }, "node_modules/npm/node_modules/fs.realpath": { "version": "1.0.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/function-bind": { "version": "1.1.1", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/gauge": { "version": "4.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17504,7 +17435,6 @@ }, "node_modules/npm/node_modules/glob": { "version": "8.0.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17523,13 +17453,11 @@ }, "node_modules/npm/node_modules/graceful-fs": { "version": "4.2.10", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/has": { "version": "1.0.3", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17541,7 +17469,6 @@ }, "node_modules/npm/node_modules/has-flag": { "version": "4.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17550,13 +17477,11 @@ }, "node_modules/npm/node_modules/has-unicode": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/hosted-git-info": { "version": "5.2.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17568,13 +17493,11 @@ }, "node_modules/npm/node_modules/http-cache-semantics": { "version": "4.1.1", - "extraneous": true, "inBundle": true, "license": "BSD-2-Clause" }, "node_modules/npm/node_modules/http-proxy-agent": { "version": "5.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17588,7 +17511,6 @@ }, "node_modules/npm/node_modules/https-proxy-agent": { "version": "5.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17601,7 +17523,6 @@ }, "node_modules/npm/node_modules/humanize-ms": { "version": "1.2.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17610,9 +17531,9 @@ }, "node_modules/npm/node_modules/iconv-lite": { "version": "0.6.3", - "extraneous": true, "inBundle": true, "license": "MIT", + "optional": true, "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, @@ -17622,7 +17543,6 @@ }, "node_modules/npm/node_modules/ignore-walk": { "version": "5.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17634,7 +17554,6 @@ }, "node_modules/npm/node_modules/imurmurhash": { "version": "0.1.4", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17643,7 +17562,6 @@ }, "node_modules/npm/node_modules/indent-string": { "version": "4.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17652,13 +17570,11 @@ }, "node_modules/npm/node_modules/infer-owner": { "version": "1.0.4", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/inflight": { "version": "1.0.6", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17668,13 +17584,11 @@ }, "node_modules/npm/node_modules/inherits": { "version": "2.0.4", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/ini": { "version": "3.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -17683,7 +17597,6 @@ }, "node_modules/npm/node_modules/init-package-json": { "version": "3.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17701,13 +17614,11 @@ }, "node_modules/npm/node_modules/ip": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/ip-regex": { "version": "4.3.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17716,7 +17627,6 @@ }, "node_modules/npm/node_modules/is-cidr": { "version": "4.0.2", - "extraneous": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -17728,7 +17638,6 @@ }, "node_modules/npm/node_modules/is-core-module": { "version": "2.10.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -17740,7 +17649,6 @@ }, "node_modules/npm/node_modules/is-fullwidth-code-point": { "version": "3.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -17749,25 +17657,21 @@ }, "node_modules/npm/node_modules/is-lambda": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/isexe": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/json-parse-even-better-errors": { "version": "2.3.1", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/json-stringify-nice": { "version": "1.1.4", - "extraneous": true, "inBundle": true, "license": "ISC", "funding": { @@ -17779,25 +17683,21 @@ "engines": [ "node >= 0.2.0" ], - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/just-diff": { "version": "5.1.1", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/just-diff-apply": { "version": "5.4.1", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/libnpmaccess": { "version": "6.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17812,7 +17712,6 @@ }, "node_modules/npm/node_modules/libnpmdiff": { "version": "4.0.5", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17831,7 +17730,6 @@ }, "node_modules/npm/node_modules/libnpmexec": { "version": "4.0.14", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17856,7 +17754,6 @@ }, "node_modules/npm/node_modules/libnpmfund": { "version": "3.0.5", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17868,7 +17765,6 @@ }, "node_modules/npm/node_modules/libnpmhook": { "version": "8.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17881,7 +17777,6 @@ }, "node_modules/npm/node_modules/libnpmorg": { "version": "4.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17894,7 +17789,6 @@ }, "node_modules/npm/node_modules/libnpmpack": { "version": "4.1.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17908,7 +17802,6 @@ }, "node_modules/npm/node_modules/libnpmpublish": { "version": "6.0.5", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17924,7 +17817,6 @@ }, "node_modules/npm/node_modules/libnpmsearch": { "version": "5.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17936,7 +17828,6 @@ }, "node_modules/npm/node_modules/libnpmteam": { "version": "4.0.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17949,7 +17840,6 @@ }, "node_modules/npm/node_modules/libnpmversion": { "version": "3.0.7", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -17965,7 +17855,6 @@ }, "node_modules/npm/node_modules/lru-cache": { "version": "7.13.2", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -17974,7 +17863,6 @@ }, "node_modules/npm/node_modules/make-fetch-happen": { "version": "10.2.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18001,7 +17889,6 @@ }, "node_modules/npm/node_modules/minimatch": { "version": "5.1.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18013,7 +17900,6 @@ }, "node_modules/npm/node_modules/minipass": { "version": "3.3.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18025,7 +17911,6 @@ }, "node_modules/npm/node_modules/minipass-collect": { "version": "1.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18037,7 +17922,6 @@ }, "node_modules/npm/node_modules/minipass-fetch": { "version": "2.1.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18054,7 +17938,6 @@ }, "node_modules/npm/node_modules/minipass-flush": { "version": "1.0.5", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18066,7 +17949,6 @@ }, "node_modules/npm/node_modules/minipass-json-stream": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18076,7 +17958,6 @@ }, "node_modules/npm/node_modules/minipass-pipeline": { "version": "1.2.4", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18088,7 +17969,6 @@ }, "node_modules/npm/node_modules/minipass-sized": { "version": "1.0.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18100,7 +17980,6 @@ }, "node_modules/npm/node_modules/minizlib": { "version": "2.1.2", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18113,7 +17992,6 @@ }, "node_modules/npm/node_modules/mkdirp": { "version": "1.0.4", - "extraneous": true, "inBundle": true, "license": "MIT", "bin": { @@ -18125,7 +18003,6 @@ }, "node_modules/npm/node_modules/mkdirp-infer-owner": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18139,19 +18016,16 @@ }, "node_modules/npm/node_modules/ms": { "version": "2.1.3", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/mute-stream": { "version": "0.0.8", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/negotiator": { "version": "0.6.3", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -18160,7 +18034,6 @@ }, "node_modules/npm/node_modules/node-gyp": { "version": "9.1.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18184,7 +18057,6 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/brace-expansion": { "version": "1.1.11", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18194,7 +18066,6 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/glob": { "version": "7.2.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18214,7 +18085,6 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/minimatch": { "version": "3.1.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18226,7 +18096,6 @@ }, "node_modules/npm/node_modules/node-gyp/node_modules/nopt": { "version": "5.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18241,7 +18110,6 @@ }, "node_modules/npm/node_modules/nopt": { "version": "6.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18256,7 +18124,6 @@ }, "node_modules/npm/node_modules/normalize-package-data": { "version": "4.0.1", - "extraneous": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -18271,7 +18138,6 @@ }, "node_modules/npm/node_modules/npm-audit-report": { "version": "3.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18283,7 +18149,6 @@ }, "node_modules/npm/node_modules/npm-bundled": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18295,7 +18160,6 @@ }, "node_modules/npm/node_modules/npm-bundled/node_modules/npm-normalize-package-bin": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -18304,7 +18168,6 @@ }, "node_modules/npm/node_modules/npm-install-checks": { "version": "5.0.0", - "extraneous": true, "inBundle": true, "license": "BSD-2-Clause", "dependencies": { @@ -18316,13 +18179,11 @@ }, "node_modules/npm/node_modules/npm-normalize-package-bin": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/npm-package-arg": { "version": "9.1.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18337,7 +18198,6 @@ }, "node_modules/npm/node_modules/npm-packlist": { "version": "5.1.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18355,7 +18215,6 @@ }, "node_modules/npm/node_modules/npm-packlist/node_modules/npm-normalize-package-bin": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -18364,7 +18223,6 @@ }, "node_modules/npm/node_modules/npm-pick-manifest": { "version": "7.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18379,7 +18237,6 @@ }, "node_modules/npm/node_modules/npm-pick-manifest/node_modules/npm-normalize-package-bin": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -18388,7 +18245,6 @@ }, "node_modules/npm/node_modules/npm-profile": { "version": "6.2.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18401,7 +18257,6 @@ }, "node_modules/npm/node_modules/npm-registry-fetch": { "version": "13.3.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18419,13 +18274,11 @@ }, "node_modules/npm/node_modules/npm-user-validate": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "BSD-2-Clause" }, "node_modules/npm/node_modules/npmlog": { "version": "6.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18440,7 +18293,6 @@ }, "node_modules/npm/node_modules/once": { "version": "1.4.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18449,7 +18301,6 @@ }, "node_modules/npm/node_modules/opener": { "version": "1.5.2", - "extraneous": true, "inBundle": true, "license": "(WTFPL OR MIT)", "bin": { @@ -18458,7 +18309,6 @@ }, "node_modules/npm/node_modules/p-map": { "version": "4.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18473,7 +18323,6 @@ }, "node_modules/npm/node_modules/pacote": { "version": "13.6.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18508,7 +18357,6 @@ }, "node_modules/npm/node_modules/parse-conflict-json": { "version": "2.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18522,7 +18370,6 @@ }, "node_modules/npm/node_modules/path-is-absolute": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -18531,7 +18378,6 @@ }, "node_modules/npm/node_modules/postcss-selector-parser": { "version": "6.0.10", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18544,7 +18390,6 @@ }, "node_modules/npm/node_modules/proc-log": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -18553,7 +18398,6 @@ }, "node_modules/npm/node_modules/promise-all-reject-late": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "funding": { @@ -18562,7 +18406,6 @@ }, "node_modules/npm/node_modules/promise-call-limit": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "funding": { @@ -18571,13 +18414,11 @@ }, "node_modules/npm/node_modules/promise-inflight": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/promise-retry": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18590,7 +18431,6 @@ }, "node_modules/npm/node_modules/promzard": { "version": "0.3.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18599,7 +18439,6 @@ }, "node_modules/npm/node_modules/qrcode-terminal": { "version": "0.12.0", - "extraneous": true, "inBundle": true, "bin": { "qrcode-terminal": "bin/qrcode-terminal.js" @@ -18607,7 +18446,6 @@ }, "node_modules/npm/node_modules/read": { "version": "1.0.7", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18619,7 +18457,6 @@ }, "node_modules/npm/node_modules/read-cmd-shim": { "version": "3.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -18628,7 +18465,6 @@ }, "node_modules/npm/node_modules/read-package-json": { "version": "5.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18643,7 +18479,6 @@ }, "node_modules/npm/node_modules/read-package-json-fast": { "version": "2.0.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18656,7 +18491,6 @@ }, "node_modules/npm/node_modules/read-package-json/node_modules/npm-normalize-package-bin": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -18665,7 +18499,6 @@ }, "node_modules/npm/node_modules/readable-stream": { "version": "3.6.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18679,7 +18512,6 @@ }, "node_modules/npm/node_modules/readdir-scoped-modules": { "version": "1.1.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18691,7 +18523,6 @@ }, "node_modules/npm/node_modules/retry": { "version": "0.12.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -18700,7 +18531,6 @@ }, "node_modules/npm/node_modules/rimraf": { "version": "3.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18715,7 +18545,6 @@ }, "node_modules/npm/node_modules/rimraf/node_modules/brace-expansion": { "version": "1.1.11", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18725,7 +18554,6 @@ }, "node_modules/npm/node_modules/rimraf/node_modules/glob": { "version": "7.2.3", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18745,7 +18573,6 @@ }, "node_modules/npm/node_modules/rimraf/node_modules/minimatch": { "version": "3.1.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18757,7 +18584,6 @@ }, "node_modules/npm/node_modules/safe-buffer": { "version": "5.2.1", - "extraneous": true, "funding": [ { "type": "github", @@ -18777,13 +18603,12 @@ }, "node_modules/npm/node_modules/safer-buffer": { "version": "2.1.2", - "extraneous": true, "inBundle": true, - "license": "MIT" + "license": "MIT", + "optional": true }, "node_modules/npm/node_modules/semver": { "version": "7.3.7", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18798,7 +18623,6 @@ }, "node_modules/npm/node_modules/semver/node_modules/lru-cache": { "version": "6.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18810,19 +18634,16 @@ }, "node_modules/npm/node_modules/set-blocking": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/signal-exit": { "version": "3.0.7", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/smart-buffer": { "version": "4.2.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { @@ -18832,7 +18653,6 @@ }, "node_modules/npm/node_modules/socks": { "version": "2.7.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18846,7 +18666,6 @@ }, "node_modules/npm/node_modules/socks-proxy-agent": { "version": "7.0.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18860,7 +18679,6 @@ }, "node_modules/npm/node_modules/spdx-correct": { "version": "3.1.1", - "extraneous": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -18870,13 +18688,11 @@ }, "node_modules/npm/node_modules/spdx-exceptions": { "version": "2.3.0", - "extraneous": true, "inBundle": true, "license": "CC-BY-3.0" }, "node_modules/npm/node_modules/spdx-expression-parse": { "version": "3.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18886,13 +18702,11 @@ }, "node_modules/npm/node_modules/spdx-license-ids": { "version": "3.0.11", - "extraneous": true, "inBundle": true, "license": "CC0-1.0" }, "node_modules/npm/node_modules/ssri": { "version": "9.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18904,7 +18718,6 @@ }, "node_modules/npm/node_modules/string_decoder": { "version": "1.3.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18913,7 +18726,6 @@ }, "node_modules/npm/node_modules/string-width": { "version": "4.2.3", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18927,7 +18739,6 @@ }, "node_modules/npm/node_modules/strip-ansi": { "version": "6.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18939,7 +18750,6 @@ }, "node_modules/npm/node_modules/supports-color": { "version": "7.2.0", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -18951,7 +18761,6 @@ }, "node_modules/npm/node_modules/tar": { "version": "6.1.11", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -18968,19 +18777,16 @@ }, "node_modules/npm/node_modules/text-table": { "version": "0.2.0", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/tiny-relative-date": { "version": "1.3.0", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/treeverse": { "version": "2.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "engines": { @@ -18989,7 +18795,6 @@ }, "node_modules/npm/node_modules/unique-filename": { "version": "2.0.1", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -19001,7 +18806,6 @@ }, "node_modules/npm/node_modules/unique-slug": { "version": "3.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -19013,13 +18817,11 @@ }, "node_modules/npm/node_modules/util-deprecate": { "version": "1.0.2", - "extraneous": true, "inBundle": true, "license": "MIT" }, "node_modules/npm/node_modules/validate-npm-package-license": { "version": "3.0.4", - "extraneous": true, "inBundle": true, "license": "Apache-2.0", "dependencies": { @@ -19029,7 +18831,6 @@ }, "node_modules/npm/node_modules/validate-npm-package-name": { "version": "4.0.0", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -19041,13 +18842,11 @@ }, "node_modules/npm/node_modules/walk-up-path": { "version": "1.0.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/wcwidth": { "version": "1.0.1", - "extraneous": true, "inBundle": true, "license": "MIT", "dependencies": { @@ -19056,7 +18855,6 @@ }, "node_modules/npm/node_modules/which": { "version": "2.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -19071,7 +18869,6 @@ }, "node_modules/npm/node_modules/wide-align": { "version": "1.1.5", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -19080,13 +18877,11 @@ }, "node_modules/npm/node_modules/wrappy": { "version": "1.0.2", - "extraneous": true, "inBundle": true, "license": "ISC" }, "node_modules/npm/node_modules/write-file-atomic": { "version": "4.0.2", - "extraneous": true, "inBundle": true, "license": "ISC", "dependencies": { @@ -19099,7 +18894,6 @@ }, "node_modules/npm/node_modules/yallist": { "version": "4.0.0", - "extraneous": true, "inBundle": true, "license": "ISC" }, diff --git a/test/unit/password-reset-email-request-test.js b/test/unit/password-reset-email-request-test.js index 2861a0fe2..d46772891 100644 --- a/test/unit/password-reset-email-request-test.js +++ b/test/unit/password-reset-email-request-test.js @@ -101,9 +101,10 @@ describe('PasswordResetEmailRequest', () => { PasswordResetEmailRequest.post(req, res) .then(() => { - expect(PasswordResetEmailRequest.handlePost).to.have.been.called() + expect(PasswordResetEmailRequest.handlePost).to.have.been.called(); }) }) + }) describe('validate()', () => { @@ -153,6 +154,39 @@ describe('PasswordResetEmailRequest', () => { expect(request.error).to.not.have.been.called() }) }) + + it('should hande a reset request with no username without privacy leakage', () => { + const host = SolidHost.from({ serverUri: 'https://example.com' }) + const store = { suffixAcl: '.acl' } + const accountManager = AccountManager.from({ host, multiuser: true, store }) + accountManager.loadAccountRecoveryEmail = sinon.stub().resolves('alice@example.com') + accountManager.sendPasswordResetEmail = sinon.stub().resolves() + accountManager.accountExists = sinon.stub().resolves(false) + + const returnToUrl = 'https://example.com/resource' + const username = 'alice' + const response = HttpMocks.createResponse() + response.render = sinon.stub() + + const options = { accountManager, username, returnToUrl, response } + const request = new PasswordResetEmailRequest(options) + + sinon.spy(request, 'error') + sinon.spy(request, 'validate') + sinon.spy(request, 'loadUser') + + return PasswordResetEmailRequest.handlePost(request) + .then(() => { + expect(request.validate).to.have.been.called() + expect(request.loadUser).to.have.been.called(); + expect(request.loadUser).to.throw(); + }).catch(() => { + expect(request.error).to.have.been.called() + expect(response.render).to.have.been.calledWith('auth/reset-link-sent') + expect(accountManager.loadAccountRecoveryEmail).to.not.have.been.called() + expect(accountManager.sendPasswordResetEmail).to.not.have.been.called() + }) + }) }) describe('loadUser()', () => { @@ -184,6 +218,7 @@ describe('PasswordResetEmailRequest', () => { request.loadUser() .catch(error => { + expect(error.code).to.equal('ACCOUNT_MISSING'); expect(error.message).to.equal('Account not found for that username') done() })