From 4dad078802b8b5059cd6b2855f04b3b6654a647f Mon Sep 17 00:00:00 2001 From: "gao.zhiyuan" Date: Fri, 9 Sep 2022 17:40:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=BD=95=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- api/app/lib/controllers/auth/index.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/app/lib/controllers/auth/index.js b/api/app/lib/controllers/auth/index.js index 088db8f..d038b79 100644 --- a/api/app/lib/controllers/auth/index.js +++ b/api/app/lib/controllers/auth/index.js @@ -75,10 +75,14 @@ async function login (ctx, next) { // await transaction.rollback(); ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`); ctx.status = 400; + let message = typeof error == 'string' ? error + : error.response.body.message || "登录失败" + if (message == '账号或密码错误') { + message = '无此用户,请使用正确的登录信息' + } + ctx.body = { - message: - typeof error == 'string' ? error - : error.response.body.message || "登录失败" + message: message } } }