mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Fixed settings validation error not distinguishing between publishable/secret keys
no issue - when saving Stripe keys with `stripeDirect: true` config, if either key didn't match the key format the returned validation error always contained `stripe_secret_key` - updated to output `stripe_publishable_key` if it was the publishable key that was invalid
This commit is contained in:
parent
7d4596adf6
commit
7195a904ba
1 changed files with 6 additions and 6 deletions
|
@ -384,11 +384,11 @@ Settings = ghostBookshelf.Model.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
const secretKeyRegex = /pk_(?:test|live)_[\da-zA-Z]{1,247}$/;
|
||||
const publishableKeyRegex = /pk_(?:test|live)_[\da-zA-Z]{1,247}$/;
|
||||
|
||||
if (!secretKeyRegex.test(value)) {
|
||||
if (!publishableKeyRegex.test(value)) {
|
||||
throw new errors.ValidationError({
|
||||
message: `stripe_secret_key did not match ${secretKeyRegex}`
|
||||
message: `stripe_publishable_key did not match ${publishableKeyRegex}`
|
||||
});
|
||||
}
|
||||
},
|
||||
|
@ -412,11 +412,11 @@ Settings = ghostBookshelf.Model.extend({
|
|||
return;
|
||||
}
|
||||
|
||||
const secretKeyRegex = /pk_(?:test|live)_[\da-zA-Z]{1,247}$/;
|
||||
const publishableKeyRegex = /pk_(?:test|live)_[\da-zA-Z]{1,247}$/;
|
||||
|
||||
if (!secretKeyRegex.test(value)) {
|
||||
if (!publishableKeyRegex.test(value)) {
|
||||
throw new errors.ValidationError({
|
||||
message: `stripe_secret_key did not match ${secretKeyRegex}`
|
||||
message: `stripe_publishable_key did not match ${publishableKeyRegex}`
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue