From 32c4e96cbf49eca00fa0056b45b214ead15049dd Mon Sep 17 00:00:00 2001 From: github-actions Date: Mon, 5 Aug 2024 21:39:39 +0200 Subject: [PATCH] disable password change for demo users --- application/models/User_model.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/application/models/User_model.php b/application/models/User_model.php index 4e3f0af46..fa3a8dd6c 100644 --- a/application/models/User_model.php +++ b/application/models/User_model.php @@ -305,11 +305,14 @@ class User_Model extends CI_Model { // Hash password if($fields['user_password'] != NULL) { - if ($fields['user_password'] !== $pwd_placeholder) { - $decoded_password = htmlspecialchars_decode($fields['user_password']); - $data['user_password'] = $this->_hash($decoded_password); - if($data['user_password'] == EPASSWORDINVALID) { - return EPASSWORDINVALID; + if (!file_exists('.demo') || (file_exists('.demo') && $this->session->userdata('user_type') == 99)) { + + if ($fields['user_password'] !== $pwd_placeholder) { + $decoded_password = htmlspecialchars_decode($fields['user_password']); + $data['user_password'] = $this->_hash($decoded_password); + if($data['user_password'] == EPASSWORDINVALID) { + return EPASSWORDINVALID; + } } } }