@@ 58-60 (lines=3) @@ | ||
55 | * @return WC_Order |
|
56 | */ |
|
57 | protected function get_order_from_request() { |
|
58 | if ( ! isset( $_GET['nonce'] ) || ! wp_verify_nonce( sanitize_key( $_GET['nonce'] ), 'wc_stripe_confirm_pi' ) ) { |
|
59 | throw new WC_Stripe_Exception( 'missing-nonce', __( 'CSRF verification failed.', 'woocommerce-gateway-stripe' ) ); |
|
60 | } |
|
61 | ||
62 | // Load the order ID. |
|
63 | $order_id = null; |
|
@@ 156-161 (lines=6) @@ | ||
153 | $source_id = wc_clean( $_POST['stripe_source_id'] ); |
|
154 | ||
155 | // 1. Verify. |
|
156 | if ( |
|
157 | ! wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'wc_stripe_create_si' ) |
|
158 | || ! preg_match( '/^src_.*$/', $source_id ) |
|
159 | ) { |
|
160 | throw new Exception( __( 'Unable to verify your request. Please reload the page and try again.', 'woocommerce-gateway-stripe' ) ); |
|
161 | } |
|
162 | ||
163 | ||
164 | // 2. Load the customer ID (and create a customer eventually). |