Fix warning when logging in with blank username

This commit is contained in:
Trevor Slocum 2021-04-07 18:01:31 -07:00
parent 03b88dc9fb
commit 4c8996b7d1

View File

@ -359,13 +359,13 @@ function manageCheckLogIn($requireKey) {
if (isset($_POST['username']) && isset($_POST['managepassword']) && $_POST['username'] != '' && $_POST['managepassword'] != '') { if (isset($_POST['username']) && isset($_POST['managepassword']) && $_POST['username'] != '' && $_POST['managepassword'] != '') {
checkCAPTCHA(TINYIB_MANAGECAPTCHA); checkCAPTCHA(TINYIB_MANAGECAPTCHA);
$account = accountByUsername($_POST['username']); $a = accountByUsername($_POST['username']);
if (hashData($_POST['managepassword'], true) !== $account['password']) { if (empty($a) || hashData($_POST['managepassword'], true) !== $a['password']) {
fancyDie(__('Invalid username or password.')); fancyDie(__('Invalid username or password.'));
} }
$_SESSION['tinyib_key'] = hashData(TINYIB_MANAGEKEY); $_SESSION['tinyib_key'] = hashData(TINYIB_MANAGEKEY);
$_SESSION['tinyib_username'] = $account['username']; $_SESSION['tinyib_username'] = $a['username'];
$_SESSION['tinyib_password'] = $account['password']; $_SESSION['tinyib_password'] = $a['password'];
} }
if (isset($_SESSION['tinyib_username']) && isset($_SESSION['tinyib_password'])) { if (isset($_SESSION['tinyib_username']) && isset($_SESSION['tinyib_password'])) {