From e1fb41e55834e7a6719a64f1548cffa2cc8ba86b Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Tue, 14 Mar 2023 12:49:49 +0700 Subject: [PATCH] Make activate key lenght configurable --- library/includes/init_bb.php | 3 ++- library/includes/ucp/register.php | 4 ++-- library/includes/ucp/sendpasswd.php | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/library/includes/init_bb.php b/library/includes/init_bb.php index 825ae4da0..f570cba32 100644 --- a/library/includes/init_bb.php +++ b/library/includes/init_bb.php @@ -274,8 +274,9 @@ define('SHOW_PEERS_NAMES', 2); define('SHOW_PEERS_FULL', 3); define('SEARCH_ID_LENGTH', 12); +define('ACTKEY_LENGHT', 32); define('SID_LENGTH', 20); -define('LOGIN_KEY_LENGTH', 12); +define('LOGIN_KEY_LENGTH', 32); define('USERNAME_MAX_LENGTH', 25); define('USEREMAIL_MAX_LENGTH', 40); diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php index 28bb73688..4a51d15f9 100644 --- a/library/includes/ucp/register.php +++ b/library/includes/ucp/register.php @@ -535,7 +535,7 @@ if ($submit && !$errors) { */ if ($mode == 'register') { if ($bb_cfg['reg_email_activation']) { - $user_actkey = make_rand_str(12); + $user_actkey = make_rand_str(ACTKEY_LENGHT); $db_data['user_active'] = 0; $db_data['user_actkey'] = $user_actkey; } else { @@ -600,7 +600,7 @@ if ($submit && !$errors) { // если что-то было изменено if ($db_data) { if (!$pr_data['user_active']) { - $user_actkey = make_rand_str(12); + $user_actkey = make_rand_str(ACTKEY_LENGHT); $pr_data['user_actkey'] = $user_actkey; $db_data['user_actkey'] = $user_actkey; diff --git a/library/includes/ucp/sendpasswd.php b/library/includes/ucp/sendpasswd.php index e170c2dd3..2d8cd54a0 100644 --- a/library/includes/ucp/sendpasswd.php +++ b/library/includes/ucp/sendpasswd.php @@ -37,7 +37,7 @@ if (isset($_POST['submit'])) { $username = $row['username']; $user_id = $row['user_id']; - $user_actkey = make_rand_str(12); + $user_actkey = make_rand_str(ACTKEY_LENGHT); $user_password = make_rand_str(8); $sql = "UPDATE " . BB_USERS . "