Updated name validation for offer to restrict to 40 chars

refs https://github.com/TryGhost/Team/issues/1236

Stripe allows coupon names to be only upto 40 chars long, while Ghost allowed them to be 191 chars. This change updates the admin validation to restrict name to 40 chars to match Stripe limit
This commit is contained in:
Rishabh 2021-11-24 18:18:22 +05:30
parent 67a10184dc
commit 7cd09eee96

View File

@ -9,8 +9,8 @@ export default BaseValidator.create({
model.errors.add('name', 'Please enter a name.');
this.invalidate();
}
if (!validator.isLength(model.name || '', 0, 191)) {
model.errors.add('name', 'Name cannot be longer than 191 characters.');
if (!validator.isLength(model.name || '', 0, 40)) {
model.errors.add('name', 'Name cannot be longer than 40 characters.');
this.invalidate();
}
},