From d4aa3e4e07caabefb455a9a6da25e1660cfdd695 Mon Sep 17 00:00:00 2001 From: ajnart Date: Wed, 26 Jul 2023 13:17:00 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20edit=20mode=20password=20w?= =?UTF-8?q?orking=20with=20lowercase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/api/configs/tryPassword.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pages/api/configs/tryPassword.tsx b/src/pages/api/configs/tryPassword.tsx index 1632985ab..6e6b98670 100644 --- a/src/pages/api/configs/tryPassword.tsx +++ b/src/pages/api/configs/tryPassword.tsx @@ -5,8 +5,12 @@ function Post(req: NextApiRequest, res: NextApiResponse) { const { tried, type = 'password' } = req.body; // If the type of password is "edit", we run this branch to check the edit password if (type === 'edit') { - if (tried === process.env.EDIT_MODE_PASSWORD) { - process.env.DISABLE_EDIT_MODE = process.env.DISABLE_EDIT_MODE === 'true' ? 'false' : 'true'; + if ((tried === process.env.EDIT_MODE_PASSWORD) !== undefined) { + if (process.env.DISABLE_EDIT_MODE?.toLowerCase() === 'true') { + process.env.DISABLE_EDIT_MODE = 'false'; + } else { + process.env.DISABLE_EDIT_MODE = 'true'; + } return res.status(200).json({ success: true, });