mirror of
https://github.com/phpbb/phpbb.git
synced 2025-04-17 06:16:34 +02:00
Merge pull request #5679 from mrgoldy/ticket/16123
[ticket/16123] Show proper banned email message
This commit is contained in:
commit
a9a44c295f
phpBB/includes
tests/functions
@ -1945,9 +1945,10 @@ function validate_user_email($email, $allowed_email = false)
|
||||
return $validate_email;
|
||||
}
|
||||
|
||||
if (($ban = $user->check_ban(false, false, $email, true)) !== false)
|
||||
$ban = $user->check_ban(false, false, $email, true);
|
||||
if (!empty($ban))
|
||||
{
|
||||
return ($ban === true) ? 'EMAIL_BANNED' : (!empty($ban['ban_give_reason']) ? $ban['ban_give_reason'] : $ban);
|
||||
return !empty($ban['ban_give_reason']) ? $ban['ban_give_reason'] : 'EMAIL_BANNED';
|
||||
}
|
||||
|
||||
if (!$config['allow_emailreuse'])
|
||||
|
@ -1,5 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<dataset>
|
||||
<table name="phpbb_banlist">
|
||||
<column>ban_id</column>
|
||||
<column>ban_userid</column>
|
||||
<column>ban_exclude</column>
|
||||
<column>ban_end</column>
|
||||
<column>ban_email</column>
|
||||
<column>ban_give_reason</column>
|
||||
<row>
|
||||
<value>1</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>banned@example.com</value>
|
||||
<value></value>
|
||||
</row>
|
||||
<row>
|
||||
<value>2</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>0</value>
|
||||
<value>banned2@example.com</value>
|
||||
<value>just because</value>
|
||||
</row>
|
||||
</table>
|
||||
<table name="phpbb_users">
|
||||
<column>user_id</column>
|
||||
<column>username</column>
|
||||
|
@ -28,10 +28,16 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case
|
||||
|
||||
protected function setUp()
|
||||
{
|
||||
global $cache, $phpbb_dispatcher, $phpbb_root_path, $phpEx;
|
||||
|
||||
parent::setUp();
|
||||
|
||||
$cache = new \phpbb\cache\driver\file();
|
||||
$cache->purge();
|
||||
$this->db = $this->new_dbal();
|
||||
$this->user = new phpbb_mock_user;
|
||||
$phpbb_dispatcher = new phpbb_mock_event_dispatcher();
|
||||
$language = new phpbb\language\language(new phpbb\language\language_file_loader($phpbb_root_path, $phpEx));
|
||||
$this->user = new phpbb\user($language, '\phpbb\datetime');
|
||||
$this->helper = new phpbb_functions_validate_data_helper($this);
|
||||
}
|
||||
|
||||
@ -47,7 +53,6 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case
|
||||
$config['email_check_mx'] = $check_mx;
|
||||
$db = $this->db;
|
||||
$user = $this->user;
|
||||
$user->optionset('banned_users', array('banned@example.com'));
|
||||
}
|
||||
|
||||
public static function validate_user_email_data()
|
||||
@ -58,7 +63,8 @@ class phpbb_functions_validate_user_email_test extends phpbb_database_test_case
|
||||
array('valid_complex', array(), "'%$~test@example.com"),
|
||||
array('invalid', array('EMAIL_INVALID'), 'fööbar@example.com'),
|
||||
array('taken', array('EMAIL_TAKEN'), 'admin@example.com'),
|
||||
array('banned', array('EMAIL_BANNED'), 'banned@example.com'),
|
||||
array('banned', ['just because'], 'banned2@example.com'),
|
||||
array('banned', ['EMAIL_BANNED'], 'banned@example.com')
|
||||
);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user