Task List: verify Stripe key patterns before continuing. (https://github.com/woocommerce/woocommerce-admin/pull/3910)

This commit is contained in:
Jeff Stieler 2020-03-17 11:22:42 -06:00 committed by GitHub
parent f8afb04187
commit b8e1874cd9
1 changed files with 4 additions and 4 deletions

View File

@ -298,15 +298,15 @@ class Stripe extends Component {
validateManualConfig( values ) {
const errors = {};
if ( ! values.publishable_key ) {
if ( values.publishable_key.match( /^pk_live_/ ) === null ) {
errors.publishable_key = __(
'Please enter your publishable key',
'Please enter a valid publishable key. Valid keys start with "pk_live".',
'woocommerce-admin'
);
}
if ( ! values.secret_key ) {
if ( values.secret_key.match( /^[rs]k_live_/ ) === null ) {
errors.secret_key = __(
'Please enter your secret key',
'Please enter a valid secret key. Valid keys start with "sk_live" or "rk_live".',
'woocommerce-admin'
);
}