summaryrefslogtreecommitdiffstats
path: root/admin/inc
diff options
context:
space:
mode:
authornashe <contact@nashe.fr>2015-08-04 17:11:23 +0200
committernashe <contact@nashe.fr>2015-08-04 17:11:23 +0200
commitcb5e73816fa0308b22c7274509b23059ce1d5eda (patch)
treedf25afeb4c4c0b2438a187976265599b2e1c5bd0 /admin/inc
parentd77b52c4c194edce0060cbb99fd07d31645297e6 (diff)
downloadplanet-cb5e73816fa0308b22c7274509b23059ce1d5eda.tar
planet-cb5e73816fa0308b22c7274509b23059ce1d5eda.tar.gz
planet-cb5e73816fa0308b22c7274509b23059ce1d5eda.tar.bz2
planet-cb5e73816fa0308b22c7274509b23059ce1d5eda.tar.xz
planet-cb5e73816fa0308b22c7274509b23059ce1d5eda.zip
Make authentication timing-safe
Improve the authentication to make it timing-safe against bruteforce attacks. See code comments for more details on the implementation.
Diffstat (limited to 'admin/inc')
-rw-r--r--admin/inc/auth.inc.php3
1 files changed, 2 insertions, 1 deletions
diff --git a/admin/inc/auth.inc.php b/admin/inc/auth.inc.php
index 1640cb0..db6e571 100644
--- a/admin/inc/auth.inc.php
+++ b/admin/inc/auth.inc.php
@@ -1,8 +1,9 @@
<?php
include dirname(__FILE__).'/pwd.inc.php';
+require_once __DIR__.'/../../app/classes/Planet.class.php';
-if (!isset($_COOKIE['auth']) || $_COOKIE['auth'] !== $password) {
+if (!Planet::authenticateUser($_COOKIE['auth'], $password)) {
setcookie('auth', '', time() - 3600);
header('Location: login.php');
die();