tbar0970 / jethro-pmm

Jethro Pastoral Ministry Manager
GNU General Public License v3.0
35 stars 25 forks source link

2FA: Stacktrace when 2FA_SENDER_ID is blank #1021

Closed jefft closed 4 months ago

jefft commented 5 months ago

Testing 2FA: if my conf.php contains:

// Sender ID for 2-factor auth SMS messages
define('2FA_SENDER_ID','');

as suggested by conf.php.sample, then after entering a correct username+password I get a stacktrace:

Notice: Undefined index: system in /home/jethro/code/2.35.0-RC3/app/include/sms_sender.class.php on line 177

Fatal error: Uncaught Error: Call to a member function getDBObject() on null in /home/jethro/code/2.35.0-RC3/app/include/sms_sender.class.php:177 Stack trace: #0 /home/jethro/code/2.35.0-RC3/app/include/user_system.class.php(428): SMS_Sender::sendMessage() #1 /home/jethro/code/2.35.0-RC3/app/include/user_system.class.php(405): User_System->_send2FAMessage() #2 /home/jethro/code/2.35.0-RC3/app/include/user_system.class.php(47): User_System->_init2FA() #3 /home/jethro/code/2.35.0-RC3/app/index.php(52): User_System->__construct() #4 {main} thrown in /home/jethro/code/2.35.0-RC3/app/include/sms_sender.class.php on line 177

This happens regardless of whether any other 2FA_ variables are set.

jefft commented 5 months ago

If 2FA_SENDER_ID is a mandatory field, then aside from failing with a sensible error, perhaps conf.php.sample could contain:

// Sender ID for 2-factor auth SMS messages. This may be a mobile number or alphanumeric string up to 11 digits
//define('2FA_SENDER_ID', 'Jethro');