From 98b72ca5722205ead9dffb230690cfecc8336f1d Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Wed, 17 Mar 2021 12:10:52 -0400 Subject: [PATCH] fix: allow local (and overridden) login strategies to pass Error objects back --- src/controllers/authentication.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/authentication.js b/src/controllers/authentication.js index 5d8cc4dff4..f57eb185be 100644 --- a/src/controllers/authentication.js +++ b/src/controllers/authentication.js @@ -266,7 +266,9 @@ function continueLogin(strategy, req, res, next) { } if (!userData) { - if (typeof info === 'object') { + if (info instanceof Error) { + info = info.message; + } else if (typeof info === 'object') { info = '[[error:invalid-username-or-password]]'; } return helpers.noScriptErrors(req, res, info, 403);