Check that only allowed chars are used for invoice prefix

This commit is contained in:
Alex P 2021-12-06 12:58:51 +02:00
parent 7428a4446b
commit 487e6bfb31
2 changed files with 16 additions and 9 deletions

View file

@ -88,3 +88,7 @@
.woocommerce_page_wc-settings h3.ppcp-subheading {
font-size: 1.1em;
}
.input-text[pattern]:invalid {
border: red solid 2px;
}

View file

@ -740,8 +740,11 @@ return array(
'title' => __( 'Invoice prefix', 'woocommerce-paypal-payments' ),
'type' => 'text',
'desc_tip' => true,
'description' => __( 'If you use your PayPal account with more than one installation, please use a distinct prefix to separate those installations. Please do not use numbers in your prefix.', 'woocommerce-paypal-payments' ),
'description' => __( 'If you use your PayPal account with more than one installation, please use a distinct prefix to separate those installations. Please use only English letters and "-", "_" characters.', 'woocommerce-paypal-payments' ),
'maxlength' => 15,
'custom_attributes' => array(
'pattern' => '[a-zA-Z_-]+',
),
'default' => ( static function (): string {
$site_url = get_site_url( get_current_blog_id() );
$hash = md5( $site_url );