mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 10:55:00 +08:00
⏪️ Losen the validation rules for Client ID
This reverts commit 9037fa9b7d
.
This commit is contained in:
parent
93f517e50f
commit
1f3a18a690
3 changed files with 3 additions and 2 deletions
|
@ -96,7 +96,7 @@ const ManualConnectionForm = () => {
|
||||||
// On-the-fly form validation.
|
// On-the-fly form validation.
|
||||||
useEffect( () => {
|
useEffect( () => {
|
||||||
setClientValid(
|
setClientValid(
|
||||||
! manualClientId || /^[\w-]{80,}$/.test( manualClientId )
|
! manualClientId || /^A[\w-]{79}$/.test( manualClientId )
|
||||||
);
|
);
|
||||||
setSecretValid( manualClientSecret && manualClientSecret.length > 0 );
|
setSecretValid( manualClientSecret && manualClientSecret.length > 0 );
|
||||||
}, [ manualClientId, manualClientSecret ] );
|
}, [ manualClientId, manualClientSecret ] );
|
||||||
|
|
|
@ -88,6 +88,7 @@ class AuthenticationRestEndpoint extends RestEndpoint {
|
||||||
'type' => 'string',
|
'type' => 'string',
|
||||||
'sanitize_callback' => 'sanitize_text_field',
|
'sanitize_callback' => 'sanitize_text_field',
|
||||||
'minLength' => 80,
|
'minLength' => 80,
|
||||||
|
'maxLength' => 80,
|
||||||
),
|
),
|
||||||
'clientSecret' => array(
|
'clientSecret' => array(
|
||||||
'required' => true,
|
'required' => true,
|
||||||
|
|
|
@ -147,7 +147,7 @@ class AuthenticationManager {
|
||||||
throw new RuntimeException( 'No client ID provided.' );
|
throw new RuntimeException( 'No client ID provided.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( false === preg_match( '/^[\w-]{80,}$/', $client_secret ) ) {
|
if ( false === preg_match( '/^A[\w-]{79}$/', $client_secret ) ) {
|
||||||
throw new RuntimeException( 'Invalid client ID provided.' );
|
throw new RuntimeException( 'Invalid client ID provided.' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue