From baa16d8ab2ee789c9d4d57bf4bd793d29d85b84e Mon Sep 17 00:00:00 2001 From: whyour Date: Sun, 21 Mar 2021 18:21:37 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=97=A5=E5=BF=97=E6=9F=A5?= =?UTF-8?q?=E7=9C=8B=E5=92=8C=E7=94=A8=E6=88=B7=E8=AE=A4=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- back/api/auth.ts | 7 +++++-- src/pages/log/index.tsx | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/back/api/auth.ts b/back/api/auth.ts index 8a30cb96..004f2721 100644 --- a/back/api/auth.ts +++ b/back/api/auth.ts @@ -17,9 +17,12 @@ export default (app: Router) => { let password = req.body.password; fs.readFile(config.authConfigFile, 'utf8', function (err, data) { if (err) console.log(err); - var con = JSON.parse(data); + const authInfo = JSON.parse(data); if (username && password) { - if (username == con.user && password == con.password) { + if ( + username == authInfo.username && + password == authInfo.password + ) { let token = jwt.sign( { username, password }, config.secret as any, diff --git a/src/pages/log/index.tsx b/src/pages/log/index.tsx index 5b426087..3eb5b428 100644 --- a/src/pages/log/index.tsx +++ b/src/pages/log/index.tsx @@ -38,7 +38,7 @@ const Log = () => { const getLog = (node: any) => { setLoading(true); let url = `${node.parent}/${node.value}`; - if (!node.isDir) { + if (!node.parent) { url = node.value; } request