-
Notifications
You must be signed in to change notification settings - Fork 800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add/protect blocked send email #8117
Conversation
- adds a better UI on the blocked login page - allows folks to temporarily unblock themselves with a magic link
dbddbd1
to
7f9582c
Compare
modules/protect.php
Outdated
@@ -541,7 +541,7 @@ function block_with_math() { | |||
* Kill a login attempt | |||
*/ | |||
function kill_login() { | |||
$ip = jetpack_protect_get_ip(); | |||
$ip = jetpack_protect_get_ip(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the spacing off here?
modules/protect.php
Outdated
array ( 'response' => 403 ) | ||
); | ||
require_once dirname( __FILE__ ) . '/protect/blocked-login-page.php'; | ||
$blocked_login_page = Jetpack_Protect_Blocked_Login_Page::instance( $ip ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacing appears off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There appear to be indentation issues throughout, but otherwise it looks good. Smeelay!
|
||
public function add_args_to_lostpassword_redirect_url( $url ) { | ||
if ( $this->valid_blocked_user_id ) { | ||
$url = ( empty( $url ) ) ? wp_login_url() : $url; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
paren around empty unnecessary
return false; | ||
} | ||
|
||
if ( $this->valid_blocked_user_id ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe put this case first?
$user = get_user_by( 'email', trim( $email ) ); | ||
|
||
if ( ! $user ) { | ||
return new WP_Error( 'invalid_user', __( 'Oops, could not find a user with that email address.', 'jetpack' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this somehow be used by a hacker who is already ip blocked to test for valid email addresses/accounts on the site/domain?
$code = wp_remote_retrieve_response_code( $response ); | ||
$result = json_decode( wp_remote_retrieve_body( $response ) ); | ||
|
||
if ( 429 === $code ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider a constant like HTTP_STATUS_TOO_MANY_REQUESTS rather than a "magic number"
|
||
|
||
function get_html_blocked_login_message() { | ||
// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to remove this comment?
<?php printf( | ||
__( '<p><span style="float:left; display:block; margin-right:10px;">%1$s</span>Your IP (%2$s) has been flagged for potential security violations. <a href="%3$s">Learn More</a></p>', 'jetpack' ), | ||
$icon, | ||
str_replace( 'http://', '', esc_url( 'http://' . $this->ip_address ) ), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not determine this value before ob_start like you do for $icon?
* Changelog 5.6: create base for changelog. * Update changelog with 5.5.1 info. * Changelog: add #7930 and #8238 * Changelog: add #8076 * Changelog: add #8100 * Changelog: add #8117 * Changelog: add #8141 * Changelog: add #8143 * Changelog: add #8147 * Changelog: add #8149 * Changelog: add #8153 * Changelog: add #8173 * Changelog: add #8184 * Changelog: add #8196 * Changelog: add #8199 * Changelog: add #8093 * Changelog: add #8171 * Changelog: add #8182 * Changelog: add #8202, #8222 * Changelog: add #8228 * Changelog: add #8240 * Changelog: add #8251 * remove AL card change
Todo:
Jetpack side
.COM side
Testing instructions / p2 post on it's way...