Avoid reporting success when API key insertion fails.
This commit is contained in:
parent
68f1b12797
commit
4975a5ea21
|
@ -2126,6 +2126,10 @@ class WC_AJAX {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ( 0 === $wpdb->insert_id ) {
|
||||||
|
throw new Exception( __( 'There was an error generating your API Key.', 'woocommerce' ) );
|
||||||
|
}
|
||||||
|
|
||||||
$key_id = $wpdb->insert_id;
|
$key_id = $wpdb->insert_id;
|
||||||
$response = $data;
|
$response = $data;
|
||||||
$response['consumer_key'] = $consumer_key;
|
$response['consumer_key'] = $consumer_key;
|
||||||
|
|
Loading…
Reference in New Issue