From f1d9cba7310e172588b2cc5939cb7082dc924e2b Mon Sep 17 00:00:00 2001 From: lwcorp Date: Sun, 26 Jul 2026 23:00:00 +0300 Subject: [PATCH 1/4] Added username reminder 1. Fixed field type 1. Added fields to enter address and get a username reminder --- public_html/lists/admin/login.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public_html/lists/admin/login.php b/public_html/lists/admin/login.php index 6affa9e85..515d4812b 100644 --- a/public_html/lists/admin/login.php +++ b/public_html/lists/admin/login.php @@ -40,8 +40,12 @@ function footer() echo '
'; echo '
'; } From ec1fd9a8224de891f562345a5ef01d48eb79fbe7 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Sun, 26 Jul 2026 23:15:37 +0300 Subject: [PATCH 2/4] Added minimal margin to submit button in forgot username/password form To avoid conflict with phplist/admin/ui/phplist-ui-bootlist/css/style.css margin-top: 30px (this theme wasn't updated in years) --- public_html/lists/admin/css/app.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/public_html/lists/admin/css/app.css b/public_html/lists/admin/css/app.css index 9fa02c9d1..d46acfbfc 100644 --- a/public_html/lists/admin/css/app.css +++ b/public_html/lists/admin/css/app.css @@ -287,3 +287,7 @@ div.plugindetails > div.detail > span.value { font-weight: bold; height: 150px; } + +form#forgotpassword-form input[type="submit"] { + margin-top: 10px; +} From d597dc66b9ede3fc2f441547368d258c92aaa459 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Sun, 26 Jul 2026 23:17:47 +0300 Subject: [PATCH 3/4] Added username reminder Modeled on function sendAdminPasswordToken --- public_html/lists/admin/lib.php | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/public_html/lists/admin/lib.php b/public_html/lists/admin/lib.php index b4236ef0c..c41c267fb 100644 --- a/public_html/lists/admin/lib.php +++ b/public_html/lists/admin/lib.php @@ -417,6 +417,29 @@ function sendAdminPasswordToken($adminId) } } +//Send an email with a username reminder the specified adminId. +function sendAdminUsernameReminder($adminId) +{ + //Retrieve the admin login name and email address + $SQLquery = sprintf('select loginname,email from %s where id=%d;', $GLOBALS['tables']['admin'], $adminId); + $row = Sql_Fetch_Row_Query($SQLquery); + $adminName = $row[0]; + $email = $row[1]; + + $urlroot = getConfig('website').$GLOBALS['adminpages']; + //Build the email body to be sent, and finally send it. + $emailBody = $GLOBALS['I18N']->get('Hello')."\n\n"; + $emailBody .= $GLOBALS['I18N']->get('You have requested a username reminder for phpList.')."\n\n"; + $emailBody .= $GLOBALS['I18N']->get('Your username is:')."\n\n"; + $emailBody .= $adminName; + + if (sendMail($email, $GLOBALS['I18N']->get('Username reminder'), "\n\n".$emailBody, '', '', true)) { + return $GLOBALS['I18N']->get('A username reminder has been sent to the corresponding email address.'); + } else { + return $GLOBALS['I18N']->get('Error sending user reminder'); + } +} + function getTopSmtpServer($domain) { $mx = getmxrr($domain, $mxhosts, $weight); @@ -2522,4 +2545,4 @@ function notifyNewIPLogin($adminId) { sendMail($main_admin_mail, $GLOBALS['installation_name'].' '.s('login from new location'), $msg, system_messageheaders($admin_mail)); } -} \ No newline at end of file +} From d9d456c608f965190f74c8a96e0d1741c276e4b3 Mon Sep 17 00:00:00 2001 From: lwcorp Date: Sun, 26 Jul 2026 23:22:26 +0300 Subject: [PATCH 4/4] Added username reminder Added fields and infrastructure to allow sending a username reminder --- public_html/lists/admin/index.php | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/public_html/lists/admin/index.php b/public_html/lists/admin/index.php index c747423e7..a7e2e39a3 100644 --- a/public_html/lists/admin/index.php +++ b/public_html/lists/admin/index.php @@ -344,12 +344,22 @@ function mb_strtolower($string) } } //If passwords are encrypted and a password recovery request was made, send mail to the admin of the given email address. - } elseif (isset($_REQUEST['forgotpassword'])) { - $adminId = $GLOBALS['admin_auth']->adminIdForEmail($_REQUEST['forgotpassword']); + } elseif (isset($_REQUEST['forgotpassword']) || isset($_REQUEST['forgotusername'])) { + $addressReminderType = ''; + $addressReminder = ''; + if (isset($_REQUEST['forgotpassword']) && !empty($_REQUEST['forgotpassword'])) { + $addressReminderType = 'password'; + $addressReminder = $_REQUEST['forgotpassword']; + } elseif (isset($_REQUEST['forgotusername']) && !empty($_REQUEST['forgotusername'])) { + $addressReminderType = 'username'; + $addressReminder = $_REQUEST['forgotusername']; + } + $adminId = $GLOBALS['admin_auth']->adminIdForEmail($addressReminder); if ($adminId) { - $msg = sendAdminPasswordToken($adminId); + $msg = ($addressReminderType == 'password') ? sendAdminPasswordToken($adminId) : sendAdminUsernameReminder($adminId); } else { - $msg = $GLOBALS['I18N']->get('Failed sending a change password token'); + if (empty($addressReminderType)) $addressReminderType = 'password'; + $msg = $GLOBALS['I18N']->get('Failed sending a ' . (($addressReminderType == 'password') ? 'change password token' : 'username reminder')); } $page = 'login'; } elseif (!empty($_GET['secret'])