Skip to content

Commit

Permalink
Merge pull request #487 from bigcommerce/fix/security
Browse files Browse the repository at this point in the history
fix: adjusted the messaging of the auth screens
  • Loading branch information
chanceaclark authored Dec 12, 2024
2 parents da3384f + 88123b9 commit 7311d71
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 22 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## [5.1.2]

### Fixed
- Updated auth screen messaging to comply with OWASP guidelines.

## [5.1.1]

### Changed
Expand Down Expand Up @@ -1934,6 +1939,7 @@
in fact, reset postdata, so far as Gutenberg 3.2.0 is concerned.


[5.1.2]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.1.1...5.1.2
[5.1.1]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.1.0...5.1.1
[5.1.0]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.0.8...5.1.0
[5.0.8]: https://github.com/bigcommerce/bigcommerce-for-wordpress/compare/5.0.7...5.0.8
Expand Down
2 changes: 1 addition & 1 deletion bigcommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Plugin Name: BigCommerce for WordPress
Description: Scale your ecommerce business with WordPress on the front-end and BigCommerce on the back end. Free up server resources from things like catalog management, processing payments, and managing fulfillment logistics.
Author: BigCommerce
Version: 5.1.1
Version: 5.1.2
Author URI: https://www.bigcommerce.com/wordpress
Requires PHP: 7.4.0
Text Domain: bigcommerce
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: bigcommerce, moderntribe, jbrinley, becomevocal, vincentlistrani,
Tags: ecommerce, online store, sell online, storefront, retail, online shop, bigcommerce, big commerce, e-commerce, physical products, buy buttons, commerce, shopping cart, checkout, cart, shop, headless commerce, shipping, payments, fulfillment
Requires at least: 5.2
Tested up to: 6.7
Stable tag: 5.1.1
Stable tag: 5.1.2
Requires PHP: 7.4.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Expand Down
1 change: 0 additions & 1 deletion src/BigCommerce/Accounts/Login.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


use BigCommerce\Accounts\Roles\Customer as Customer_Role;
use Bigcommerce\Api;
use BigCommerce\Api_Factory;
use BigCommerce\Import\Processors\Store_Settings;
use BigCommerce\Pages\Account_Page;
Expand Down
17 changes: 2 additions & 15 deletions src/BigCommerce/Forms/Registration_Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use BigCommerce\Accounts\Login;
use BigCommerce\Accounts\Roles\Customer as Customer_Role;
use BigCommerce\Accounts\User_Profile_Settings;
use BigCommerce\Container\Accounts;
use BigCommerce\Import\Processors\Default_Customer_Group;
use BigCommerce\Import\Processors\Store_Settings;
use BigCommerce\Pages\Account_Page;
Expand Down Expand Up @@ -78,7 +77,7 @@ public function handle_request( $submission ) {
$errors->add( 'email', $user_id->get_error_message() );
break;
case 'existing_user_login':
$errors->add( 'email', __( 'Sorry, that email address is already used!', 'bigcommerce' ) );
$errors->add( 'email', __( 'Failed to create your account.', 'bigcommerce' ) );
break;
case 'empty_user_login':
case 'user_login_too_long':
Expand Down Expand Up @@ -176,17 +175,6 @@ private function should_handle_request( $submission ) {
return true;
}

/**
* @param $email
*
* @return bool
*/
private function is_email_free( $email ): bool {
$user = get_user_by( 'login', $email );

return empty( $user );
}

private function validate_submission( $submission ) {
$errors = new \WP_Error();

Expand All @@ -205,10 +193,9 @@ private function validate_submission( $submission ) {
$errors->add( 'email', __( 'Email Address is required.', 'bigcommerce' ) );
} elseif ( ! is_email( $submission[ 'bc-register' ][ 'email' ] ) ) {
$errors->add( 'email', __( 'Please verify that you have submitted a valid email address.', 'bigcommerce' ) );
} elseif ( ! $this->is_email_free( $submission['bc-register']['email'] ) ) {
$errors->add( 'email', __( 'Sorry, that email address is already used!', 'bigcommerce' ) );
}


if ( empty( $submission[ 'bc-register' ][ 'new_password' ] ) ) {
$errors->add( 'new_password', __( 'Please set your password.', 'bigcommerce' ) );
}
Expand Down
2 changes: 1 addition & 1 deletion src/BigCommerce/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
namespace BigCommerce;

class Plugin {
const VERSION = '5.1.1';
const VERSION = '5.1.2';

protected static $_instance;

Expand Down
2 changes: 1 addition & 1 deletion src/BigCommerce/Shortcodes/Registration_Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ public function render( $attr, $instance ) {
return $component->render();
}

}
}
10 changes: 8 additions & 2 deletions src/BigCommerce/Templates/Lost_Password_Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,18 @@ private function get_message() {
}
switch ( $_GET[ 'bc-message' ] ) {
case 'empty_username':
case 'invalid_email':
$message = Message::factory( [
Message::CONTENT => __( 'Please enter a valid email address.', 'bigcommerce' ),
Message::CONTENT => __( 'Please enter an email address.', 'bigcommerce' ),
Message::TYPE => Message::ERROR,
] );

return $message->render();
case 'invalid_email':
$message = Message::factory( [
Message::CONTENT => __( 'Check your email for the reset link.', 'bigcommerce' ),
Message::TYPE => Message::NOTICE,
] );

return $message->render();
default:
return '';
Expand Down

0 comments on commit 7311d71

Please sign in to comment.