Merge pull request #1232 from ajnart/fix-env-not-working

Fix env not working
This commit is contained in:
Thomas Camlong
2023-08-01 18:38:52 +09:00
committed by GitHub
3 changed files with 10 additions and 9 deletions

View File

@@ -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,
});