🐛 Fix edit mode password working with lowercase

This commit is contained in:
ajnart
2023-07-26 13:17:00 +09:00
parent 52f5e9af96
commit d4aa3e4e07

View File

@@ -5,8 +5,12 @@ function Post(req: NextApiRequest, res: NextApiResponse) {
const { tried, type = 'password' } = req.body; const { tried, type = 'password' } = req.body;
// If the type of password is "edit", we run this branch to check the edit password // If the type of password is "edit", we run this branch to check the edit password
if (type === 'edit') { if (type === 'edit') {
if (tried === process.env.EDIT_MODE_PASSWORD) { if ((tried === process.env.EDIT_MODE_PASSWORD) !== undefined) {
process.env.DISABLE_EDIT_MODE = process.env.DISABLE_EDIT_MODE === 'true' ? 'false' : 'true'; 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({ return res.status(200).json({
success: true, success: true,
}); });