Avoid reporting success when API key insertion fails.
This commit is contained in:
parent
20038828bb
commit
624f2eac4b
|
@ -2131,6 +2131,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;
|
||||
$response = $data;
|
||||
$response['consumer_key'] = $consumer_key;
|
||||
|
|
Loading…
Reference in New Issue