N°3985 - Performance checks on the back end

This commit is contained in:
Eric
2021-08-23 13:57:03 +02:00
parent ffbd94d671
commit 2c2155a8e0
35 changed files with 747 additions and 241 deletions

View File

@@ -15,6 +15,7 @@
//
// You should have received a copy of the GNU Affero General Public License
// along with iTop. If not, see <http://www.gnu.org/licenses/>
use Combodo\iTop\Application\Helper\Session;
/**
* The standardized result of any pass/fail check performed by the setup
@@ -2064,7 +2065,7 @@ JS
}
$sUID = hash('sha256', rand());
file_put_contents(APPROOT.'data/setup/authent', $sUID);
$_SESSION['setup_token'] = $sUID;
Session::Set('setup_token', $sUID);
return $sUID;
}
@@ -2096,8 +2097,8 @@ JS
*/
public static function IsSessionSetupTokenValid()
{
if (isset($_SESSION['setup_token'])) {
$sAuth = $_SESSION['setup_token'];
if (Session::IsSet('setup_token')) {
$sAuth = Session::Get('setup_token');
$sTokenFile = APPROOT.'data/setup/authent';
if (file_exists($sTokenFile) && $sAuth === file_get_contents($sTokenFile)) {
return true;
@@ -2116,7 +2117,7 @@ JS
if (is_file($sTokenFile)) {
unlink($sTokenFile);
}
unset($_SESSION['setup_token']);
Session::Unset('setup_token');
}