Skip to content

Commit

Permalink
Fix for login issues when using Google Chrome and Domain is an IP
Browse files Browse the repository at this point in the history
For #465 and #995
  • Loading branch information
eSilverStrike committed Nov 26, 2019
1 parent 1b2e844 commit 8daed87
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions system/lib-sessions.php
Expand Up @@ -54,7 +54,12 @@
// e.g. 'localhost' or other local names
$_CONF['cookiedomain'] = '';
} else {
$_CONF['cookiedomain'] = '.' . $server[1];
// Issue #465 - IP Check Added: Google Chrome doesn't like it when IP is used as domain and cookies do not get set
if (filter_var($server[1], FILTER_VALIDATE_IP)) {
$_CONF['cookiedomain'] = '';
} else {
$_CONF['cookiedomain'] = '.' . $server[1];
}
}
}
if ($_SESS_VERBOSE) {
Expand Down Expand Up @@ -193,11 +198,11 @@ function SESS_sessionCheck()
$_USER['status'] = USER_ACCOUNT_NEW_EMAIL;
DB_change($_TABLES['users'], 'status', USER_ACCOUNT_NEW_EMAIL, 'uid', $_USER['uid']);
}

if ($_USER['status'] == USER_ACCOUNT_LOCKED) {
// Account is locked so user shouldn't be logged in
if ($_SERVER['PHP_SELF'] !== '/users.php') {
COM_redirect($_CONF['site_url'] . '/users.php?mode=logout&msg=17');
COM_redirect($_CONF['site_url'] . '/users.php?mode=logout&msg=17');
}
} elseif ($_USER['status'] == USER_ACCOUNT_NEW_EMAIL || $_USER['status'] == USER_ACCOUNT_NEW_PASSWORD) {
// Account requires additional info so get it
Expand All @@ -208,8 +213,8 @@ function SESS_sessionCheck()
COM_redirect($_CONF['site_url'] . '/users.php?mode=newpwdstatus');
}
}
}

}
}
}

Expand Down

0 comments on commit 8daed87

Please sign in to comment.