From e816be32df05a59f2836cbc23936790a61b1076c Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Sat, 9 Nov 2024 00:53:38 +0700 Subject: [PATCH] Updated --- library/includes/functions.php | 9 ++++++++- src/Legacy/Common/User.php | 8 -------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/library/includes/functions.php b/library/includes/functions.php index aeb9e04d2..7bce661bf 100644 --- a/library/includes/functions.php +++ b/library/includes/functions.php @@ -849,7 +849,14 @@ function show_bt_userdata($user_id): void global $template; if (!$btu = get_bt_userdata($user_id)) { - return; + // Generate passkey + if (!\TorrentPier\Legacy\Torrent::getPasskey($user_id)) { + if (!\TorrentPier\Legacy\Torrent::generate_passkey($user_id, true)) { + bb_simple_die('Could not generate passkey'); + } else { + show_bt_userdata($user_id); + } + } } $template->assign_vars([ diff --git a/src/Legacy/Common/User.php b/src/Legacy/Common/User.php index 33efa5cb2..678a7f905 100644 --- a/src/Legacy/Common/User.php +++ b/src/Legacy/Common/User.php @@ -10,7 +10,6 @@ namespace TorrentPier\Legacy\Common; use TorrentPier\Legacy\DateDelta; -use TorrentPier\Legacy\Torrent; use TorrentPier\Sessions; use Exception; @@ -253,13 +252,6 @@ class User $user_id = (int)$this->data['user_id']; $mod_admin_session = ((int)$this->data['user_level'] === ADMIN || (int)$this->data['user_level'] === MOD); - // Generate passkey - if (!Torrent::getPasskey($this->data['user_id'])) { - if (!Torrent::generate_passkey($this->data['user_id'], true)) { - bb_simple_die('Could not generate passkey'); - } - } - // Create new session for ($i = 0, $max_try = 5; $i <= $max_try; $i++) { $session_id = make_rand_str(SID_LENGTH);