From 8df33ca9cd08ac726fbb1a059690527548050fd2 Mon Sep 17 00:00:00 2001
From: Adhidarma Hadiwinoto <me@adhisimon.org>
Date: Wed, 15 Jul 2020 15:14:19 +0700
Subject: [PATCH] 
 config.sdk_supplier_product_quota.allow_non_super_terminal_login

---
 lib/control-panel/index.js | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/lib/control-panel/index.js b/lib/control-panel/index.js
index 5ccbcd2..d4e6b34 100644
--- a/lib/control-panel/index.js
+++ b/lib/control-panel/index.js
@@ -65,7 +65,16 @@ app.post('/login', express.urlencoded({ extended: false }), async (req, res) =>
     const { username, password } = req.body;
     const terminal = await coreTerminalAuth.validateWebPassword(username, password);
 
-    if (!terminal || !terminal.terminal_is_super || !terminal.store_is_super) {
+    if (!terminal || !terminal.store_is_super) {
+        res.redirect('/login');
+        return;
+    }
+
+    if (
+        config.sdk_supplier_product_quota
+        && !config.sdk_supplier_product_quota.allow_non_super_terminal_login
+        && !terminal.terminal_is_super
+    ) {
         res.redirect('/login');
         return;
     }
-- 
1.9.0