Skip to content

Commit

Permalink
Fix: Prevent registration bypass when user registration is disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathancaron committed Feb 5, 2025
1 parent 7d10dd7 commit 7819440
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/wp-login.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
/** Make sure that the WordPress bootstrap has run before continuing. */
require __DIR__ . '/wp-load.php';

// Prevent registration if the users_can_register option is disabled
if (isset($_GET['action']) && $_GET['action'] === 'register' && !get_option('users_can_register')) {

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

No space after opening parenthesis is prohibited

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 spaces before closing parenthesis; 0 found

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Use Yoda Condition checks, you must.

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 space after "!"; 0 found

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 spaces after opening parenthesis; 0 found

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 spaces before closing parenthesis; 0 found

Check failure on line 15 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

No space before closing parenthesis is prohibited
wp_die(__('Registration is disabled on this site.'));

Check failure on line 16 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Tabs must be used to indent lines; spaces are not allowed

Check failure on line 16 in src/wp-login.php

View workflow job for this annotation

GitHub Actions / PHP coding standards / Run coding standards checks

Expected 1 spaces after opening parenthesis; 0 found
}

// Redirect to HTTPS login if forced to use SSL.
if ( force_ssl_admin() && ! is_ssl() ) {
if ( str_starts_with( $_SERVER['REQUEST_URI'], 'http' ) ) {
Expand Down

0 comments on commit 7819440

Please sign in to comment.