diff --git a/includes/api/wc-rest-authentication.php b/includes/api/wc-rest-authentication.php index 18de0524730..21aaf0745bc 100644 --- a/includes/api/wc-rest-authentication.php +++ b/includes/api/wc-rest-authentication.php @@ -209,7 +209,7 @@ class WC_REST_Authentication { // Sort parameters. if ( ! uksort( $params, 'strcmp' ) ) { - return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid Signature - failed to sort parameters', 'woocommerce' ), array( 'status' => 401 ) ); + return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid Signature - failed to sort parameters.', 'woocommerce' ), array( 'status' => 401 ) ); } // Normalize parameter key/values. @@ -229,7 +229,7 @@ class WC_REST_Authentication { $string_to_sign = $http_method . '&' . $base_request_uri . '&' . $query_string; if ( $params['oauth_signature_method'] !== 'HMAC-SHA1' && $params['oauth_signature_method'] !== 'HMAC-SHA256' ) { - return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid Signature - signature method is invalid', 'woocommerce' ), array( 'status' => 401 ) ); + return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid Signature - signature method is invalid.', 'woocommerce' ), array( 'status' => 401 ) ); } $hash_algorithm = strtolower( str_replace( 'HMAC-', '', $params['oauth_signature_method'] ) ); @@ -238,7 +238,7 @@ class WC_REST_Authentication { $signature = base64_encode( hash_hmac( $hash_algorithm, $string_to_sign, $secret, true ) ); if ( ! hash_equals( $signature, $consumer_signature ) ) { - return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid Signature - provided signature does not match', 'woocommerce' ), array( 'status' => 401 ) ); + return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid Signature - provided signature does not match.', 'woocommerce' ), array( 'status' => 401 ) ); } return true; @@ -289,7 +289,7 @@ class WC_REST_Authentication { $valid_window = 15 * 60; // 15 minute window. if ( ( $timestamp < time() - $valid_window ) || ( $timestamp > time() + $valid_window ) ) { - return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid timestamp', 'woocommerce' ), array( 'status' => 401 ) ); + return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid timestamp.', 'woocommerce' ), array( 'status' => 401 ) ); } $used_nonces = maybe_unserialize( $user->nonces ); @@ -299,7 +299,7 @@ class WC_REST_Authentication { } if ( in_array( $nonce, $used_nonces ) ) { - return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid nonce - nonce has already been used', 'woocommerce' ), array( 'status' => 401 ) ); + return new WP_Error( 'woocommerce_rest_authentication_error', __( 'Invalid nonce - nonce has already been used.', 'woocommerce' ), array( 'status' => 401 ) ); } $used_nonces[ $timestamp ] = $nonce; @@ -411,7 +411,7 @@ class WC_REST_Authentication { global $wc_rest_authentication_error; if ( is_wp_error( $wc_rest_authentication_error ) && is_ssl() ) { - $auth_message = __( 'WooCommerce API. Use a consumer key in the username field and a consumer secret in the password field', 'woocommerce' ); + $auth_message = __( 'WooCommerce API - Use a consumer key in the username field and a consumer secret in the password field.', 'woocommerce' ); $response->header( 'WWW-Authenticate', 'Basic realm="' . $auth_message . '"', true ); }