From 72ded8494ae673725cbbf4baa71706bc2f248dd2 Mon Sep 17 00:00:00 2001 From: David Goodwin Date: Wed, 13 Jan 2021 22:43:05 +0000 Subject: [PATCH] wrap pacrypt() call with a try/catch to log/handle issues where an exception is thrown - see https://github.com/postfixadmin/postfixadmin/issues/420 --- model/Login.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/model/Login.php b/model/Login.php index 96bbe21d..b85d8c32 100644 --- a/model/Login.php +++ b/model/Login.php @@ -29,8 +29,13 @@ class Login { if (sizeof($result) == 1) { $row = $result[0]; - $crypt_password = pacrypt($password, $row['password']); - + try { + $crypt_password = pacrypt($password, $row['password']); + } catch (\Exception $e) { + error_log("Error while trying to call pacrypt()"); + error_log($e); + return false; // just refuse to login? + } return hash_equals($row['password'], $crypt_password); }