From 08fbbe46c74aea2800e495e6218abbc103bf9f1a Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Tue, 28 Nov 2017 08:54:34 +0100 Subject: [PATCH] gui: demo mode fix Signed-off-by: Janos SUTO --- webui/model/user/prefs.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/webui/model/user/prefs.php b/webui/model/user/prefs.php index 20c83993..a92bb628 100644 --- a/webui/model/user/prefs.php +++ b/webui/model/user/prefs.php @@ -84,6 +84,10 @@ class ModelUserPrefs extends Model { public function toggle_ga($username = '', $ga_enabled = '') { if($username == "" || $ga_enabled < 0 || $ga_enabled > 1) { return 0; } + // In demo mode you can't enable Google AUthenticator since other users + // would NOT be able to login without the GA secret + if(DEMO_MODE && in_array($username, ['admin@local', 'auditor@local'])) { return 1; } + $query = $this->db->query("UPDATE " . TABLE_USER_SETTINGS . " SET ga_enabled=? WHERE username=?", array($ga_enabled, $username)); return 1;