Skip to content

Commit

Permalink
Use filtered wp_lostpassword_url() method instead of calling the filt…
Browse files Browse the repository at this point in the history
…ering function directly.
  • Loading branch information
brianhogg committed Aug 21, 2024
1 parent 4c8a940 commit 713c7fd
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 29 deletions.
13 changes: 2 additions & 11 deletions includes/class.llms.person.handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ protected static function find_password_fields( $location ) {
}

return $fields;

}

/**
Expand Down Expand Up @@ -120,7 +119,7 @@ public static function generate_username( $email ) {
while ( username_exists( $username ) ) {

$username = $orig_username . $i;
$i++;
++$i;

}

Expand All @@ -133,7 +132,6 @@ public static function generate_username( $email ) {
* @param string $email User's email address which was used to generate the username.
*/
return apply_filters( 'lifterlms_generated_username', $username, $email );

}

/**
Expand Down Expand Up @@ -196,13 +194,12 @@ public static function get_login_fields( $layout = 'columns' ) {
'columns' => ( 'columns' == $layout ) ? 3 : 6,
'id' => 'llms_lost_password',
'last_column' => true,
'description' => '<a href="' . esc_url( llms_lostpassword_url() ) . '">' . __( 'Lost your password?', 'lifterlms' ) . '</a>',
'description' => '<a href="' . esc_url( wp_lostpassword_url() ) . '">' . __( 'Lost your password?', 'lifterlms' ) . '</a>',
'type' => 'html',
'wrapper_classes' => 'align-right',
),
)
);

}

/**
Expand Down Expand Up @@ -264,7 +261,6 @@ public static function get_lost_password_fields() {
),
)
);

}

/**
Expand Down Expand Up @@ -313,7 +309,6 @@ private static function get_password_fields() {
);

return $fields;

}

/**
Expand Down Expand Up @@ -381,7 +376,6 @@ public static function get_password_reset_fields( $key = '', $login = '' ) {
* set of fields is generated programmatically.
*/
return apply_filters( 'llms_password_reset_fields', $fields, $key, $login, $location );

}

/**
Expand Down Expand Up @@ -483,7 +477,6 @@ public static function login( $data ) {
}

return $signon->ID;

}

/**
Expand Down Expand Up @@ -533,7 +526,6 @@ protected static function validate_login_fields( $data ) {
* @param array $data User submitted login data.
*/
return apply_filters( 'llms_after_user_login_data_validation', $valid, $data );

}

/**
Expand All @@ -551,5 +543,4 @@ public static function get_available_fields( $screen = 'registration', $data = a
_deprecated_function( 'LLMS_Person_Handler::get_available_fields()', '5.0.0', 'LLMS_Forms::get_form_fields()' );
return LLMS_Forms::instance()->get_form_fields( $screen );
}

}
5 changes: 1 addition & 4 deletions includes/emails/class.llms.email.reset.password.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public function init( $args = array() ) {
'{user_login}' => $args['login_display'],
)
);

}

/**
Expand All @@ -60,7 +59,7 @@ public function get_body_content( $data ) {
'key' => $data['key'],
'login' => rawurlencode( $data['user']->user_login ),
),
llms_lostpassword_url()
wp_lostpassword_url()
)
);

Expand All @@ -72,7 +71,5 @@ public function get_body_content( $data ) {
)
);
return ob_get_clean();

}

}
12 changes: 1 addition & 11 deletions includes/forms/controllers/class.llms.controller.account.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function __construct() {
add_action( 'init', array( $this, 'reset_password' ) );
add_action( 'init', array( $this, 'cancel_subscription' ) );
add_action( 'init', array( $this, 'redeem_voucher' ) );

}

/**
Expand Down Expand Up @@ -88,7 +87,6 @@ public function cancel_subscription() {
* @param integer $uid The WP_User ID the student who cancelled the subscription.
*/
do_action( 'llms_subscription_cancelled_by_student', $order, $uid );

}

/**
Expand Down Expand Up @@ -135,7 +133,6 @@ public function update() {
llms_redirect_and_exit( apply_filters( 'lifterlms_update_account_redirect', llms_get_endpoint_url( 'edit-account', '', llms_get_page_url( 'myaccount' ) ) ) );

}

}

/**
Expand Down Expand Up @@ -247,7 +244,6 @@ public function lost_password() {
// Success.
llms_add_notice( __( 'Check your e-mail for the confirmation link.', 'lifterlms' ) );
return true;

}

/**
Expand Down Expand Up @@ -275,7 +271,6 @@ public function redeem_voucher() {

llms_add_notice( __( 'Voucher redeemed successfully!', 'lifterlms' ), 'success' );
return true;

}

/**
Expand Down Expand Up @@ -306,7 +301,6 @@ public function reset_password() {
// Success.
llms_add_notice( __( 'Your password has been updated.', 'lifterlms' ) );
llms_redirect_and_exit( add_query_arg( 'password-reset', 1, llms_get_page_url( 'myaccount' ) ) );

}

/**
Expand Down Expand Up @@ -377,7 +371,6 @@ private function reset_password_handler() {
do_action( 'llms_user_password_reset', $user );

return true;

}

/**
Expand All @@ -403,9 +396,8 @@ public function reset_password_link_redirect() {

( new LLMS_Cache_Helper() )->maybe_no_cache();
llms_set_password_reset_cookie( $val );
llms_redirect_and_exit( add_query_arg( 'reset-pass', 1, llms_lostpassword_url() ) );
llms_redirect_and_exit( add_query_arg( 'reset-pass', 1, wp_lostpassword_url() ) );
}

}

/**
Expand Down Expand Up @@ -452,9 +444,7 @@ protected function validate_password_reset( $posted_data ) {
}

return true;

}

}

return new LLMS_Controller_Account();
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ protected function set_merge_data( $code ) {
break;

case '{{PASSWORD_RESET_URL}}':
$code = llms_lostpassword_url();
$code = wp_lostpassword_url();
break;

case '{{SITE_TITLE}}':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ public function test_reset_password_link_redirect_success_fake_user() {
) );

$this->expectException( LLMS_Unit_Test_Exception_Redirect::class );
$this->expectExceptionMessage( add_query_arg( 'reset-pass', 1, llms_lostpassword_url() ) . ' [302] YES' );
$this->expectExceptionMessage( add_query_arg( 'reset-pass', 1, wp_lostpassword_url() ) . ' [302] YES' );

try {

Expand Down Expand Up @@ -950,7 +950,7 @@ public function test_reset_password_link_redirect_success_real_user() {
) );

$this->expectException( LLMS_Unit_Test_Exception_Redirect::class );
$this->expectExceptionMessage( add_query_arg( 'reset-pass', 1, llms_lostpassword_url() ) . ' [302] YES' );
$this->expectExceptionMessage( add_query_arg( 'reset-pass', 1, wp_lostpassword_url() ) . ' [302] YES' );

try {

Expand Down

0 comments on commit 713c7fd

Please sign in to comment.