mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-09 02:12:44 +02:00
[ticket/11327] Clean up code a bit
PHPBB3-11327
This commit is contained in:
parent
fa5a0d5e21
commit
ba92e7d2d6
@ -565,7 +565,6 @@ $lang = array_merge($lang, array(
|
||||
|
||||
'UCP_PASSWORD_RESET_DISABLED' => 'The password reset functionality has been disabled. If you need help accessing your account, please contact the %sBoard Administrator%s',
|
||||
'UCP_REGISTER_DISABLE' => 'Creating a new account is currently not possible.',
|
||||
'UCP_REMIND' => 'Send password',
|
||||
'UCP_RESEND' => 'Send activation email',
|
||||
'UCP_WELCOME' => 'Welcome to the User Control Panel. From here you can monitor, view and update your profile, preferences, subscribed forums and topics. You can also send messages to other users (if permitted). Please ensure you read any announcements before continuing.',
|
||||
'UCP_ZEBRA' => 'Friends & Foes',
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
namespace phpbb\ucp\controller;
|
||||
|
||||
use phpbb\auth\auth;
|
||||
use phpbb\config\config;
|
||||
use phpbb\controller\helper;
|
||||
use phpbb\db\driver\driver_interface;
|
||||
@ -26,8 +27,7 @@ use phpbb\user;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
/**
|
||||
* ucp_remind
|
||||
* Sending password reminders
|
||||
* Handling forgotten passwords via reset password functionality
|
||||
*/
|
||||
class reset_password
|
||||
{
|
||||
@ -71,7 +71,7 @@ class reset_password
|
||||
protected $php_ext;
|
||||
|
||||
/**
|
||||
* ucp_remind constructor.
|
||||
* Reset password controller constructor.
|
||||
*
|
||||
* @param config $config
|
||||
* @param driver_interface $db
|
||||
@ -150,18 +150,18 @@ class reset_password
|
||||
$username = $this->request->variable('username', '', true);
|
||||
$email = strtolower($this->request->variable('email', ''));
|
||||
|
||||
add_form_key('ucp_remind');
|
||||
add_form_key('ucp_reset_password');
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
if (!check_form_key('ucp_remind'))
|
||||
if (!check_form_key('ucp_reset_password'))
|
||||
{
|
||||
trigger_error('FORM_INVALID');
|
||||
return $this->helper->message('FORM_INVALID');
|
||||
}
|
||||
|
||||
if (empty($email))
|
||||
{
|
||||
trigger_error('NO_EMAIL_USER');
|
||||
return $this->helper->message('NO_EMAIL_USER');
|
||||
}
|
||||
|
||||
$sql_array = [
|
||||
@ -211,27 +211,27 @@ class reset_password
|
||||
|
||||
if (!$user_row)
|
||||
{
|
||||
trigger_error($message);
|
||||
return $this->helper->message($message);
|
||||
}
|
||||
|
||||
if ($user_row['user_type'] == USER_IGNORE || $user_row['user_type'] == USER_INACTIVE)
|
||||
{
|
||||
trigger_error($message);
|
||||
return $this->helper->message($message);
|
||||
}
|
||||
|
||||
// Do not create multiple valid reset tokens
|
||||
if (!empty($user_row['reset_token']) && (int) $user_row['reset_token_expiration'] >= time())
|
||||
{
|
||||
trigger_error($message);
|
||||
return $this->helper->message($message);
|
||||
}
|
||||
|
||||
// Check users permissions
|
||||
$auth2 = new \phpbb\auth\auth();
|
||||
$auth2 = new auth();
|
||||
$auth2->acl($user_row);
|
||||
|
||||
if (!$auth2->acl_get('u_chgpasswd'))
|
||||
{
|
||||
trigger_error($message);
|
||||
return $this->helper->message($message);
|
||||
}
|
||||
|
||||
// Generate reset token
|
||||
@ -247,7 +247,10 @@ class reset_password
|
||||
WHERE user_id = ' . $user_row['user_id'];
|
||||
$this->db->sql_query($sql);
|
||||
|
||||
include_once($this->root_path . 'includes/functions_messenger.' . $this->php_ext);
|
||||
if (!class_exists('messenger'))
|
||||
{
|
||||
include($this->root_path . 'includes/functions_messenger.' . $this->php_ext);
|
||||
}
|
||||
|
||||
/** @var \messenger $messenger */
|
||||
$messenger = new \messenger(false);
|
||||
@ -268,7 +271,7 @@ class reset_password
|
||||
|
||||
$messenger->send($user_row['user_notify_type']);
|
||||
|
||||
trigger_error($message);
|
||||
return $this->helper->message($message);
|
||||
}
|
||||
}
|
||||
|
||||
@ -278,7 +281,7 @@ class reset_password
|
||||
'S_PROFILE_ACTION' => $this->helper->route('phpbb_ucp_forgot_password_controller'),
|
||||
]);
|
||||
|
||||
return $this->helper->render('ucp_reset_password.html', $this->language->lang('UCP_REMIND'));
|
||||
return $this->helper->render('ucp_reset_password.html', $this->language->lang('RESET_PASSWORD'));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -304,7 +307,7 @@ class reset_password
|
||||
return $this->helper->message('NO_USER');
|
||||
}
|
||||
|
||||
add_form_key('ucp_remind');
|
||||
add_form_key('ucp_reset_password');
|
||||
|
||||
$sql_array = [
|
||||
'SELECT' => 'user_id, username, user_permissions, user_email, user_jabber, user_notify_type, user_type,'
|
||||
@ -357,7 +360,7 @@ class reset_password
|
||||
|
||||
if ($submit)
|
||||
{
|
||||
if (!check_form_key('ucp_remind'))
|
||||
if (!check_form_key('ucp_reset_password'))
|
||||
{
|
||||
return $this->helper->message('FORM_INVALID');
|
||||
}
|
||||
@ -368,7 +371,7 @@ class reset_password
|
||||
}
|
||||
|
||||
// Check users permissions
|
||||
$auth2 = new \phpbb\auth\auth();
|
||||
$auth2 = new auth();
|
||||
$auth2->acl($user_row);
|
||||
|
||||
if (!$auth2->acl_get('u_chgpasswd'))
|
||||
@ -414,7 +417,7 @@ class reset_password
|
||||
$user_row['username']
|
||||
]);
|
||||
meta_refresh(3, append_sid("{$this->root_path}index.{$this->php_ext}"));
|
||||
trigger_error($this->language->lang('PASSWORD_RESET'));
|
||||
return $this->helper->message($this->language->lang('PASSWORD_RESET'));
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,6 +431,6 @@ class reset_password
|
||||
]),
|
||||
]);
|
||||
|
||||
return $this->helper->render('ucp_reset_password.html', $this->language->lang('UCP_REMIND'));
|
||||
return $this->helper->render('ucp_reset_password.html', $this->language->lang('RESET_PASSWORD'));
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!-- INCLUDE overall_header.html -->
|
||||
|
||||
<form action="{{ S_PROFILE_ACTION }}" method="post" id="remind">
|
||||
<form action="{{ S_PROFILE_ACTION }}" method="post" id="reset_password">
|
||||
|
||||
<div class="panel">
|
||||
<div class="inner">
|
||||
|
Loading…
x
Reference in New Issue
Block a user