From 3f852a3233b2ee51c3fab7dc6d077778fd35e0fd Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Thu, 8 Aug 2019 22:01:51 +0200 Subject: [PATCH] [ticket/11327] Move UCP remind functionality to a controller for password reset PHPBB3-11327 --- phpBB/config/default/container/services.yml | 1 + phpBB/config/default/container/services_ucp.yml | 15 +++++++++++++++ phpBB/config/default/routing/routing.yml | 4 ++++ phpBB/config/default/routing/ucp.yml | 3 +++ phpBB/includes/functions.php | 5 ++++- .../ucp/controller/reset_password.php} | 0 phpBB/ucp.php | 6 ++++-- 7 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 phpBB/config/default/container/services_ucp.yml create mode 100644 phpBB/config/default/routing/ucp.yml rename phpBB/{includes/ucp/ucp_remind.php => phpbb/ucp/controller/reset_password.php} (100%) diff --git a/phpBB/config/default/container/services.yml b/phpBB/config/default/container/services.yml index 3ead1e6181..2d4720029d 100644 --- a/phpBB/config/default/container/services.yml +++ b/phpBB/config/default/container/services.yml @@ -27,6 +27,7 @@ imports: - { resource: services_text_formatter.yml } - { resource: services_text_reparser.yml } - { resource: services_twig.yml } + - { resource: services_ucp.yml } - { resource: services_user.yml } - { resource: tables.yml } diff --git a/phpBB/config/default/container/services_ucp.yml b/phpBB/config/default/container/services_ucp.yml new file mode 100644 index 0000000000..615a5698c4 --- /dev/null +++ b/phpBB/config/default/container/services_ucp.yml @@ -0,0 +1,15 @@ +services: + phpbb.ucp.controller.reset_password: + class: phpbb\ucp\controller\reset_password + arguments: + - '@config' + - '@dbal.conn' + - '@dispatcher' + - '@controller.helper' + - '@language' + - '@passwords.manager' + - '@request' + - '@template' + - '@user' + - '%core.root_path%' + - '%core.php_ext%' diff --git a/phpBB/config/default/routing/routing.yml b/phpBB/config/default/routing/routing.yml index 199c5229b0..a5e9265dc3 100644 --- a/phpBB/config/default/routing/routing.yml +++ b/phpBB/config/default/routing/routing.yml @@ -26,3 +26,7 @@ phpbb_help_routing: phpbb_report_routing: resource: report.yml + +phpbb_ucp_routing: + resource: ucp.yml + prefix: /user diff --git a/phpBB/config/default/routing/ucp.yml b/phpBB/config/default/routing/ucp.yml new file mode 100644 index 0000000000..be97f597a0 --- /dev/null +++ b/phpBB/config/default/routing/ucp.yml @@ -0,0 +1,3 @@ +phpbb_ucp_reset_password_controller: + path: /reset_password + defaults: { _controller: phpbb.ucp.controller.reset_password:handle } diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 2aa98b384e..5ac26b450e 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2519,11 +2519,14 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa $s_hidden_fields = build_hidden_fields($s_hidden_fields); + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + $login_box_template_data = array( 'LOGIN_ERROR' => $err, 'LOGIN_EXPLAIN' => $l_explain, - 'U_SEND_PASSWORD' => ($config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=sendpassword') : '', + 'U_SEND_PASSWORD' => ($config['email_enable']) ? $controller_helper->route('phpbb_ucp_reset_password_controller') : '', 'U_RESEND_ACTIVATION' => ($config['require_activation'] == USER_ACTIVATION_SELF && $config['email_enable']) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=resend_act') : '', 'U_TERMS_USE' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=terms'), 'U_PRIVACY' => append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=privacy'), diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/phpbb/ucp/controller/reset_password.php similarity index 100% rename from phpBB/includes/ucp/ucp_remind.php rename to phpBB/phpbb/ucp/controller/reset_password.php diff --git a/phpBB/ucp.php b/phpBB/ucp.php index c60d9930fc..34a6c6bb99 100644 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -63,8 +63,10 @@ switch ($mode) break; case 'sendpassword': - $module->load('ucp', 'remind'); - $module->display($user->lang['UCP_REMIND']); + /** @var \phpbb\controller\helper $controller_helper */ + $controller_helper = $phpbb_container->get('controller.helper'); + + redirect($controller_helper->route('phpbb_ucp_reset_password_controller')); break; case 'register':