From 4c8996b7d11695d9dc2d19f1a95fbaa8db2b603e Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Wed, 7 Apr 2021 18:01:31 -0700 Subject: [PATCH] Fix warning when logging in with blank username --- inc/functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/inc/functions.php b/inc/functions.php index 8f7372b..26479c1 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -359,13 +359,13 @@ function manageCheckLogIn($requireKey) { if (isset($_POST['username']) && isset($_POST['managepassword']) && $_POST['username'] != '' && $_POST['managepassword'] != '') { checkCAPTCHA(TINYIB_MANAGECAPTCHA); - $account = accountByUsername($_POST['username']); - if (hashData($_POST['managepassword'], true) !== $account['password']) { + $a = accountByUsername($_POST['username']); + if (empty($a) || hashData($_POST['managepassword'], true) !== $a['password']) { fancyDie(__('Invalid username or password.')); } $_SESSION['tinyib_key'] = hashData(TINYIB_MANAGEKEY); - $_SESSION['tinyib_username'] = $account['username']; - $_SESSION['tinyib_password'] = $account['password']; + $_SESSION['tinyib_username'] = $a['username']; + $_SESSION['tinyib_password'] = $a['password']; } if (isset($_SESSION['tinyib_username']) && isset($_SESSION['tinyib_password'])) {