Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
12/12/2017 02:26:15 AM (9 years ago)
Author:
boonebgorges
Message:

Members: Require a form submission to activate an account.

Previously, simply loading a URL of the form /activate/12345 would activate
the account with key 12345. This caused conflicts with some mail scanning
services, which follow links in emails, causing accounts to be self-activated.

A small backward-compatibility layer ensures that custom activate.php
templates containing forms with action="get" continue to work.

Fixes #6049.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-members/bp-members-screens.php

    r11360 r11766  
    291291 *
    292292 * @since 1.1.0
    293  *
    294  * @todo Move the actual activation process into an action in bp-members-actions.php
    295293 */
    296294function bp_core_screen_activation() {
    … …  
    326324        }
    327325
    328         // Grab the key (the old way).
    329         $key = isset( $_GET['key'] ) ? $_GET['key'] : '';
    330 
    331         // Grab the key (the new way).
    332         if ( empty( $key ) ) {
    333                 $key = bp_current_action();
    334         }
    335 
    336326        // Get BuddyPress.
    337327        $bp = buddypress();
    338 
    339         // We've got a key; let's attempt to activate the signup.
    340         if ( ! empty( $key ) ) {
    341 
    342                 /**
    343                  * Filters the activation signup.
    344                  *
    345                  * @since 1.1.0
    346                  *
    347                  * @param bool|int $value Value returned by activation.
    348                  *                        Integer on success, boolean on failure.
    349                  */
    350                 $user = apply_filters( 'bp_core_activate_account', bp_core_activate_signup( $key ) );
    351 
    352                 // If there were errors, add a message and redirect.
    353                 if ( ! empty( $user->errors ) ) {
    354                         bp_core_add_message( $user->get_error_message(), 'error' );
    355                         bp_core_redirect( trailingslashit( bp_get_root_domain() . '/' . $bp->pages->activate->slug ) );
    356                 }
    357 
    358                 bp_core_add_message( __( 'Your account is now active!', 'buddypress' ) );
    359                 $bp->activation_complete = true;
    360         }
    361328
    362329        /**
Note: See TracChangeset for help on using the changeset viewer.