mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Multisite: Check only valid looking emails against banned domain list.
If an email address is missing an `@`, we can't assume enough to check it against a list of domain names. Additional validation of email should happen in `is_email()` before being passed to `is_email_address_unsafe()`. Fixes #39915. git-svn-id: https://develop.svn.wordpress.org/trunk@40595 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -120,6 +120,22 @@ class Tests_Multisite_IsEmailAddressUnsafe extends WP_UnitTestCase {
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
public function test_email_with_only_top_level_domain_returns_safe() {
|
||||
update_site_option( 'banned_email_domains', 'bar.com' );
|
||||
$safe = is_email_address_unsafe( 'email@localhost' );
|
||||
delete_site_option( 'banned_email_domains' );
|
||||
|
||||
$this->assertFalse( $safe );
|
||||
}
|
||||
|
||||
public function test_invalid_email_without_domain_returns_safe() {
|
||||
update_site_option( 'banned_email_domains', 'bar.com' );
|
||||
$safe = is_email_address_unsafe( 'invalid-email' );
|
||||
delete_site_option( 'bar.com' );
|
||||
|
||||
$this->assertFalse( $safe );
|
||||
}
|
||||
}
|
||||
|
||||
endif;
|
||||
|
||||
Reference in New Issue
Block a user