From 0436a99a7c55adfc453eecde97dd6589a2f3a21a Mon Sep 17 00:00:00 2001 From: Benjamin Date: Wed, 17 Jun 2026 13:43:17 +0200 Subject: [PATCH] Added delete account options --- Service/DeleteAccount/CodeService.php | 30 +++++++++++++++ XF/Admin/Controller/UserController.php | 25 ++++++++++++ XF/Pub/Controller/AccountController.php | 25 ++++++++++++ ...er-XF-Admin-Controller-UserController.json | 6 +++ ...r-XF-Pub-Controller-AccountController.json | 6 +++ _output/class_extensions/_metadata.json | 6 +++ _output/extension_hint.php | 6 +++ _output/option_groups/_metadata.json | 2 +- _output/option_groups/romhackplaza.json | 2 +- _output/option_hint.php | 1 + _output/options/_metadata.json | 3 ++ .../rhpz_delete_account_master_key.json | 13 +++++++ _output/phrases/_metadata.json | 38 ++++++++++++++++++- _output/phrases/delete_account.txt | 1 + _output/phrases/delete_account_code.txt | 1 + _output/phrases/delete_account_codes.txt | 1 + _output/phrases/delete_all_data_code.txt | 1 + .../option.rhpz_delete_account_master_key.txt | 1 + ...explain.rhpz_delete_account_master_key.txt | 0 .../option_group_description.romhackplaza.txt | 1 + _output/template_modifications/_metadata.json | 12 ++++++ .../rhpz_helper_criteria_entry_count.json | 9 +++++ ...pz_user_edit_delete_account_codes_tab.json | 9 +++++ ...r_edit_delete_account_codes_tab_panes.json | 9 +++++ .../rhpz_account_wrapper_delete_account.json | 9 +++++ _output/templates/_metadata.json | 7 +++- _output/templates/admin/helper_criteria.html | 4 -- .../admin/user_delete_account_codes.html | 15 ++++++++ 28 files changed, 235 insertions(+), 8 deletions(-) create mode 100644 Service/DeleteAccount/CodeService.php create mode 100644 XF/Admin/Controller/UserController.php create mode 100644 XF/Pub/Controller/AccountController.php create mode 100644 _output/class_extensions/XF-Admin-Controller-UserController_RomhackPlaza-Master-XF-Admin-Controller-UserController.json create mode 100644 _output/class_extensions/XF-Pub-Controller-AccountController_RomhackPlaza-Master-XF-Pub-Controller-AccountController.json create mode 100644 _output/options/rhpz_delete_account_master_key.json create mode 100644 _output/phrases/delete_account.txt create mode 100644 _output/phrases/delete_account_code.txt create mode 100644 _output/phrases/delete_account_codes.txt create mode 100644 _output/phrases/delete_all_data_code.txt create mode 100644 _output/phrases/option.rhpz_delete_account_master_key.txt create mode 100644 _output/phrases/option_explain.rhpz_delete_account_master_key.txt create mode 100644 _output/template_modifications/admin/rhpz_helper_criteria_entry_count.json create mode 100644 _output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab.json create mode 100644 _output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab_panes.json create mode 100644 _output/template_modifications/public/rhpz_account_wrapper_delete_account.json create mode 100644 _output/templates/admin/user_delete_account_codes.html diff --git a/Service/DeleteAccount/CodeService.php b/Service/DeleteAccount/CodeService.php new file mode 100644 index 0000000..86edf48 --- /dev/null +++ b/Service/DeleteAccount/CodeService.php @@ -0,0 +1,30 @@ +masterKey = \XF::options()->rhpz_delete_account_master_key; + } + + public function generateDeleteAllDataKey( User $user ) + { + $dataString = "delete_data_{$user->user_id}"; + return hash_hmac('md5', $dataString, $this->masterKey ); + } + + public function generateDeleteAccountKey( User $user ) + { + $dataString = "delete_account_{$user->user_id}"; + return hash_hmac('md5', $dataString, $this->masterKey ); + } + +} \ No newline at end of file diff --git a/XF/Admin/Controller/UserController.php b/XF/Admin/Controller/UserController.php new file mode 100644 index 0000000..ad947c8 --- /dev/null +++ b/XF/Admin/Controller/UserController.php @@ -0,0 +1,25 @@ +assertUserExists($params->user_id); + + /** @var CodeService $service */ + $service = \XF::service('RomhackPlaza\Master:DeleteAccount\CodeService'); + + $viewParams = [ + 'user' => $user, + 'deleteAllDataCode' => $service->generateDeleteAllDataKey( $user ), + 'deleteAccountCode' => $service->generateDeleteAccountKey( $user ), + ]; + + return $this->view('XF:User\DeleteAccountCodes', 'user_delete_account_codes', $viewParams); + } +} \ No newline at end of file diff --git a/XF/Pub/Controller/AccountController.php b/XF/Pub/Controller/AccountController.php new file mode 100644 index 0000000..ac78034 --- /dev/null +++ b/XF/Pub/Controller/AccountController.php @@ -0,0 +1,25 @@ + $service->generateDeleteAllDataKey( $visitor ), + 'deleteAccountCode' => $service->generateDeleteAccountKey( $visitor ), + ]; + + $view = $this->view('XF:Account\DeleteAccount', 'delete_account', $viewParams); + return $this->addAccountWrapperParams($view, 'delete_account'); + } + +} \ No newline at end of file diff --git a/_output/class_extensions/XF-Admin-Controller-UserController_RomhackPlaza-Master-XF-Admin-Controller-UserController.json b/_output/class_extensions/XF-Admin-Controller-UserController_RomhackPlaza-Master-XF-Admin-Controller-UserController.json new file mode 100644 index 0000000..0572061 --- /dev/null +++ b/_output/class_extensions/XF-Admin-Controller-UserController_RomhackPlaza-Master-XF-Admin-Controller-UserController.json @@ -0,0 +1,6 @@ +{ + "from_class": "XF\\Admin\\Controller\\UserController", + "to_class": "RomhackPlaza\\Master\\XF\\Admin\\Controller\\UserController", + "execute_order": 10, + "active": true +} \ No newline at end of file diff --git a/_output/class_extensions/XF-Pub-Controller-AccountController_RomhackPlaza-Master-XF-Pub-Controller-AccountController.json b/_output/class_extensions/XF-Pub-Controller-AccountController_RomhackPlaza-Master-XF-Pub-Controller-AccountController.json new file mode 100644 index 0000000..547489b --- /dev/null +++ b/_output/class_extensions/XF-Pub-Controller-AccountController_RomhackPlaza-Master-XF-Pub-Controller-AccountController.json @@ -0,0 +1,6 @@ +{ + "from_class": "XF\\Pub\\Controller\\AccountController", + "to_class": "RomhackPlaza\\Master\\XF\\Pub\\Controller\\AccountController", + "execute_order": 10, + "active": true +} \ No newline at end of file diff --git a/_output/class_extensions/_metadata.json b/_output/class_extensions/_metadata.json index e4bd700..87997b2 100644 --- a/_output/class_extensions/_metadata.json +++ b/_output/class_extensions/_metadata.json @@ -1,4 +1,7 @@ { + "XF-Admin-Controller-UserController_RomhackPlaza-Master-XF-Admin-Controller-UserController.json": { + "hash": "542c5dd275e5e26446a9e4a19b3c47b6" + }, "XF-Entity-ApprovalQueue_RomhackPlaza-Master-XF-Entity-ApprovalQueue.json": { "hash": "f4364e1ec74dfa80ff24368486e66ffb" }, @@ -8,6 +11,9 @@ "XF-Entity-User_RomhackPlaza-Master-XF-Entity-User.json": { "hash": "811593d6f012a53b9fa2ced871de96a9" }, + "XF-Pub-Controller-AccountController_RomhackPlaza-Master-XF-Pub-Controller-AccountController.json": { + "hash": "b34f519ca78e8977c98e0307125537bc" + }, "XF-Pub-Controller-MiscController_RomhackPlaza-Master-XF-Pub-Controller-MiscController.json": { "hash": "1071fd498b2958031153de55eb4ca66a" }, diff --git a/_output/extension_hint.php b/_output/extension_hint.php index e06e77a..1599256 100644 --- a/_output/extension_hint.php +++ b/_output/extension_hint.php @@ -8,6 +8,11 @@ * @noinspection PhpMultipleClassesDeclarationsInOneFile */ +namespace RomhackPlaza\Master\XF\Admin\Controller +{ + class XFCP_UserController extends \XF\Admin\Controller\UserController {} +} + namespace RomhackPlaza\Master\XF\Entity { class XFCP_ApprovalQueue extends \XF\Entity\ApprovalQueue {} @@ -17,6 +22,7 @@ namespace RomhackPlaza\Master\XF\Entity namespace RomhackPlaza\Master\XF\Pub\Controller { + class XFCP_AccountController extends \XF\Pub\Controller\AccountController {} class XFCP_MiscController extends \XF\Pub\Controller\MiscController {} } diff --git a/_output/option_groups/_metadata.json b/_output/option_groups/_metadata.json index 4cc733d..d79526a 100644 --- a/_output/option_groups/_metadata.json +++ b/_output/option_groups/_metadata.json @@ -1,5 +1,5 @@ { "romhackplaza.json": { - "hash": "02d554f377cebf4d2532162b1c223e64" + "hash": "e21c9e1387c95754e243002eaed87e18" } } \ No newline at end of file diff --git a/_output/option_groups/romhackplaza.json b/_output/option_groups/romhackplaza.json index eb2cfb4..af6b1e9 100644 --- a/_output/option_groups/romhackplaza.json +++ b/_output/option_groups/romhackplaza.json @@ -1,5 +1,5 @@ { - "icon": "", + "icon": "fa-umbrella-beach", "display_order": 500, "advanced": false, "debug_only": false diff --git a/_output/option_hint.php b/_output/option_hint.php index feb0449..8fee43d 100644 --- a/_output/option_hint.php +++ b/_output/option_hint.php @@ -12,6 +12,7 @@ namespace XF; /** * @property non-negative-int|null $rhpz_club_node_id Club Parent Node ID + * @property string|null $rhpz_delete_account_master_key Delete account Master key */ class Options { diff --git a/_output/options/_metadata.json b/_output/options/_metadata.json index e2eebbc..d4f4f29 100644 --- a/_output/options/_metadata.json +++ b/_output/options/_metadata.json @@ -1,5 +1,8 @@ { "rhpz_club_node_id.json": { "hash": "96114ee498a669ab50a1bc32768d3969" + }, + "rhpz_delete_account_master_key.json": { + "hash": "d649af68f404568ba3c06cc0a7121649" } } \ No newline at end of file diff --git a/_output/options/rhpz_delete_account_master_key.json b/_output/options/rhpz_delete_account_master_key.json new file mode 100644 index 0000000..e9f3f03 --- /dev/null +++ b/_output/options/rhpz_delete_account_master_key.json @@ -0,0 +1,13 @@ +{ + "edit_format": "textbox", + "edit_format_params": "", + "data_type": "string", + "sub_options": [], + "validation_class": "", + "validation_method": "", + "advanced": false, + "default_value": "", + "relations": { + "romhackplaza": 1 + } +} \ No newline at end of file diff --git a/_output/phrases/_metadata.json b/_output/phrases/_metadata.json index c0e887c..13925ba 100644 --- a/_output/phrases/_metadata.json +++ b/_output/phrases/_metadata.json @@ -1,4 +1,28 @@ { + "delete_account.txt": { + "global_cache": false, + "version_id": 1000000, + "version_string": "1.0.0", + "hash": "e6e049c44a797fda2a175d07df838e49" + }, + "delete_account_code.txt": { + "global_cache": false, + "version_id": 1000000, + "version_string": "1.0.0", + "hash": "9290d474fd3f2bdde27a87d03b99c8d0" + }, + "delete_account_codes.txt": { + "global_cache": false, + "version_id": 1000000, + "version_string": "1.0.0", + "hash": "d5fb1c03e7384236ebd589b23155b0c2" + }, + "delete_all_data_code.txt": { + "global_cache": false, + "version_id": 1000000, + "version_string": "1.0.0", + "hash": "15d96c48f857b975c051d7c98b13a385" + }, "nav.about.txt": { "global_cache": false, "version_id": 1000000, @@ -125,12 +149,24 @@ "version_string": "1.0.0", "hash": "e73496f262c162a1a35bd9e990b36825" }, + "option.rhpz_delete_account_master_key.txt": { + "global_cache": false, + "version_id": 1000000, + "version_string": "1.0.0", + "hash": "8b275759f2215b3b242de29110f05a4c" + }, "option_explain.rhpz_club_node_id.txt": { "global_cache": false, "version_id": 1000000, "version_string": "1.0.0", "hash": "d41d8cd98f00b204e9800998ecf8427e" }, + "option_explain.rhpz_delete_account_master_key.txt": { + "global_cache": false, + "version_id": 1000000, + "version_string": "1.0.0", + "hash": "d41d8cd98f00b204e9800998ecf8427e" + }, "option_group.romhackplaza.txt": { "global_cache": false, "version_id": 1000000, @@ -141,7 +177,7 @@ "global_cache": false, "version_id": 1000000, "version_string": "1.0.0", - "hash": "d41d8cd98f00b204e9800998ecf8427e" + "hash": "11821c85ed03034c1bba4294e357d089" }, "permission.romhackplaza_canEditMyEntries.txt": { "global_cache": false, diff --git a/_output/phrases/delete_account.txt b/_output/phrases/delete_account.txt new file mode 100644 index 0000000..bded51e --- /dev/null +++ b/_output/phrases/delete_account.txt @@ -0,0 +1 @@ +Delete account \ No newline at end of file diff --git a/_output/phrases/delete_account_code.txt b/_output/phrases/delete_account_code.txt new file mode 100644 index 0000000..1b717da --- /dev/null +++ b/_output/phrases/delete_account_code.txt @@ -0,0 +1 @@ +Delete account code \ No newline at end of file diff --git a/_output/phrases/delete_account_codes.txt b/_output/phrases/delete_account_codes.txt new file mode 100644 index 0000000..1955950 --- /dev/null +++ b/_output/phrases/delete_account_codes.txt @@ -0,0 +1 @@ +Delete account codes \ No newline at end of file diff --git a/_output/phrases/delete_all_data_code.txt b/_output/phrases/delete_all_data_code.txt new file mode 100644 index 0000000..07752ff --- /dev/null +++ b/_output/phrases/delete_all_data_code.txt @@ -0,0 +1 @@ +Delete all data code \ No newline at end of file diff --git a/_output/phrases/option.rhpz_delete_account_master_key.txt b/_output/phrases/option.rhpz_delete_account_master_key.txt new file mode 100644 index 0000000..749ca74 --- /dev/null +++ b/_output/phrases/option.rhpz_delete_account_master_key.txt @@ -0,0 +1 @@ +Delete account Master key \ No newline at end of file diff --git a/_output/phrases/option_explain.rhpz_delete_account_master_key.txt b/_output/phrases/option_explain.rhpz_delete_account_master_key.txt new file mode 100644 index 0000000..e69de29 diff --git a/_output/phrases/option_group_description.romhackplaza.txt b/_output/phrases/option_group_description.romhackplaza.txt index e69de29..b33d3bc 100644 --- a/_output/phrases/option_group_description.romhackplaza.txt +++ b/_output/phrases/option_group_description.romhackplaza.txt @@ -0,0 +1 @@ +These options are specific to Romhack Plaza \ No newline at end of file diff --git a/_output/template_modifications/_metadata.json b/_output/template_modifications/_metadata.json index 879129b..310ec3c 100644 --- a/_output/template_modifications/_metadata.json +++ b/_output/template_modifications/_metadata.json @@ -1,10 +1,22 @@ { + "admin/rhpz_helper_criteria_entry_count.json": { + "hash": "d94d8b880e79d281df49117a84ae62d7" + }, + "admin/rhpz_user_edit_delete_account_codes_tab.json": { + "hash": "16b7ae6dac8dbb6846df3e6eb9cd53b6" + }, + "admin/rhpz_user_edit_delete_account_codes_tab_panes.json": { + "hash": "d4f793cfd5ba4b6841bd819a12e596e9" + }, "public/rhpz_above_thread_list_clubs.json": { "hash": "c261ea6e33cf5eb7ab0a7f6fe934de7c" }, "public/rhpz_above_thread_list_clubs_buttons.json": { "hash": "c783001e00f7a63389c9ae988012f5fe" }, + "public/rhpz_account_wrapper_delete_account.json": { + "hash": "6594c0474a9b3e737a10dbd9c531521e" + }, "public/rhpz_category_view_clubs_submit_button.json": { "hash": "a24a5a4b130b6198de7ef37610aa1a7d" }, diff --git a/_output/template_modifications/admin/rhpz_helper_criteria_entry_count.json b/_output/template_modifications/admin/rhpz_helper_criteria_entry_count.json new file mode 100644 index 0000000..fcc6b11 --- /dev/null +++ b/_output/template_modifications/admin/rhpz_helper_criteria_entry_count.json @@ -0,0 +1,9 @@ +{ + "template": "helper_criteria", + "description": "", + "execution_order": 10, + "enabled": true, + "action": "str_replace", + "find": "", + "replace": "\n\t\n" +} \ No newline at end of file diff --git a/_output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab.json b/_output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab.json new file mode 100644 index 0000000..a7577ce --- /dev/null +++ b/_output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab.json @@ -0,0 +1,9 @@ +{ + "template": "user_edit", + "description": "Add Tab for listing delete account codes in User edit", + "execution_order": 10, + "enabled": true, + "action": "str_replace", + "find": "", + "replace": "\n\t{{ phrase('delete_account_codes') }}\n\n$0" +} \ No newline at end of file diff --git a/_output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab_panes.json b/_output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab_panes.json new file mode 100644 index 0000000..ef7be2e --- /dev/null +++ b/_output/template_modifications/admin/rhpz_user_edit_delete_account_codes_tab_panes.json @@ -0,0 +1,9 @@ +{ + "template": "user_edit", + "description": "Add Tab panes in User edit page for account deletion codes.", + "execution_order": 10, + "enabled": true, + "action": "str_replace", + "find": "", + "replace": "\n\n\t
  • \n\t\t
    {{ phrase('loading...') }}
    \n\t
  • \n
    \n$0" +} \ No newline at end of file diff --git a/_output/template_modifications/public/rhpz_account_wrapper_delete_account.json b/_output/template_modifications/public/rhpz_account_wrapper_delete_account.json new file mode 100644 index 0000000..5f8b32d --- /dev/null +++ b/_output/template_modifications/public/rhpz_account_wrapper_delete_account.json @@ -0,0 +1,9 @@ +{ + "template": "account_wrapper", + "description": "Add Delete account page URL to account details", + "execution_order": 10, + "enabled": true, + "action": "str_replace", + "find": "", + "replace": "\n\t{{ phrase('delete_account') }}\n\n$0" +} \ No newline at end of file diff --git a/_output/templates/_metadata.json b/_output/templates/_metadata.json index fd31b1b..a94f191 100644 --- a/_output/templates/_metadata.json +++ b/_output/templates/_metadata.json @@ -2,7 +2,12 @@ "admin/helper_criteria.html": { "version_id": 1000000, "version_string": "1.0.0", - "hash": "19cd05c4ab254dbad0abfd0c6b8c3456" + "hash": "0d8327297612e3e8eeb17e204e33694d" + }, + "admin/user_delete_account_codes.html": { + "version_id": 1000000, + "version_string": "1.0.0", + "hash": "cf9c69eb1bfa0821778f60e9866626a4" }, "public/approval_item_club_request.html": { "version_id": 1000000, diff --git a/_output/templates/admin/helper_criteria.html b/_output/templates/admin/helper_criteria.html index 6e8dd08..4184eab 100644 --- a/_output/templates/admin/helper_criteria.html +++ b/_output/templates/admin/helper_criteria.html @@ -187,10 +187,6 @@ - - - - diff --git a/_output/templates/admin/user_delete_account_codes.html b/_output/templates/admin/user_delete_account_codes.html new file mode 100644 index 0000000..747f2fe --- /dev/null +++ b/_output/templates/admin/user_delete_account_codes.html @@ -0,0 +1,15 @@ +{$user.username} + +
    +
    +

    {{ phrase('delete_account_code') }}

    +
    +
    {$deleteAccountCode}
    +
    + +

    {{ phrase('delete_all_data_code') }}

    +
    +
    {$deleteAllDataCode}
    +
    +
    +
    \ No newline at end of file