Skip to content

Commit

Permalink
better name for nonce
Browse files Browse the repository at this point in the history
  • Loading branch information
frosso committed Jul 16, 2024
1 parent f9e2a2e commit c8ea8dc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,7 @@ public function scripts() {
'platform_tracker' => wp_create_nonce( 'platform_tracks_nonce' ),
'pay_for_order' => wp_create_nonce( 'pay_for_order' ),
'tokenized_cart_nonce' => wp_create_nonce( 'woopayments_tokenized_cart_nonce' ),
'tokenized_cart_session_nonce' => wp_create_nonce( 'tokenized_cart_session_nonce' ),
'tokenized_cart_session_nonce' => wp_create_nonce( 'woopayments_tokenized_cart_session_nonce' ),
'tokenized_order_nonce' => wp_create_nonce( 'wc_store_api' ),
],
'checkout' => [
Expand Down
4 changes: 2 additions & 2 deletions includes/class-wc-payments-payment-request-session.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public function store_api_headers( $response, $server, $request ) {
}

$nonce = $request->get_header( 'X-WooPayments-Tokenized-Cart-Session-Nonce' );
if ( ! wp_verify_nonce( $nonce, 'tokenized_cart_session_nonce' ) ) {
if ( ! wp_verify_nonce( $nonce, 'woopayments_tokenized_cart_session_nonce' ) ) {
return $response;
}

Expand All @@ -157,7 +157,7 @@ public function store_api_headers( $response, $server, $request ) {
*/
public function add_payment_request_store_api_session_handler( $default_session_handler ) {
$nonce = wc_clean( wp_unslash( $_SERVER['HTTP_X_WOOPAYMENTS_TOKENIZED_CART_SESSION_NONCE'] ?? null ) );
if ( ! wp_verify_nonce( $nonce, 'tokenized_cart_session_nonce' ) ) {
if ( ! wp_verify_nonce( $nonce, 'woopayments_tokenized_cart_session_nonce' ) ) {
return $default_session_handler;
}

Expand Down

0 comments on commit c8ea8dc

Please sign in to comment.