Skip to content

Commit

Permalink
Move clean function call for auth
Browse files Browse the repository at this point in the history
  • Loading branch information
laf committed Oct 17, 2016
1 parent 6b07d6d commit 92ee374
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion html/includes/authenticate.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
$auth_success = 0;

if ((isset($_SESSION['username'])) || (isset($_COOKIE['sess_id'],$_COOKIE['token']))) {
if (reauthenticate(clean($_COOKIE['sess_id']), clean($_COOKIE['token'])) || authenticate($_SESSION['username'], $_SESSION['password'])) {
if (reauthenticate($_COOKIE['sess_id'], $_COOKIE['token']) || authenticate($_SESSION['username'], $_SESSION['password'])) {
$_SESSION['userlevel'] = get_userlevel($_SESSION['username']);
$_SESSION['user_id'] = get_userid($_SESSION['username']);
if (!$_SESSION['authenticated']) {
Expand Down
2 changes: 2 additions & 0 deletions html/includes/authentication/mysql.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ function authenticate($username, $password)

function reauthenticate($sess_id, $token)
{
$sess_id = clean($sess_id);
$token = clean($token);
list($uname,$hash) = explode('|', $token);
$session = dbFetchRow("SELECT * FROM `session` WHERE `session_username` = '$uname' AND session_value='$sess_id'", array(), true);
$hasher = new PasswordHash(8, false);
Expand Down

0 comments on commit 92ee374

Please sign in to comment.