From b2be140742108feac3a70f45487762b98a790173 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 12 Aug 2025 00:33:24 +0300 Subject: [PATCH 1/2] Validation for valid gpg key --- modules/core/public/lib/validations/gpg.liquid | 8 ++++++++ modules/core/public/translations/en/validation.yml | 1 + 2 files changed, 9 insertions(+) create mode 100644 modules/core/public/lib/validations/gpg.liquid diff --git a/modules/core/public/lib/validations/gpg.liquid b/modules/core/public/lib/validations/gpg.liquid new file mode 100644 index 0000000..03634f2 --- /dev/null +++ b/modules/core/public/lib/validations/gpg.liquid @@ -0,0 +1,8 @@ +{% liquid + assign valid_gpg = object[field_name]['key'] | is_valid_gpg + unless valid_gpg + assign message = 'modules/core/validation.invalid_gpg' | t + function c = 'modules/core/helpers/register_error', contract: c, field_name: field_name, message: message, key: key + endunless + return c +%} diff --git a/modules/core/public/translations/en/validation.yml b/modules/core/public/translations/en/validation.yml index 06a1a48..87dde99 100644 --- a/modules/core/public/translations/en/validation.yml +++ b/modules/core/public/translations/en/validation.yml @@ -48,3 +48,4 @@ en: number: must include at least one number invalid: invalid not_exist: not exist + invalid_gpg: must be a valid GPG key From 9a865fd37f5424a6754cd0c4accd1c474f5915e2 Mon Sep 17 00:00:00 2001 From: Andrew Date: Tue, 12 Aug 2025 18:38:48 +0300 Subject: [PATCH 2/2] Renamed is_valid_gpg -> is_gpg_valid --- modules/core/public/lib/validations/gpg.liquid | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/public/lib/validations/gpg.liquid b/modules/core/public/lib/validations/gpg.liquid index 03634f2..e4a809b 100644 --- a/modules/core/public/lib/validations/gpg.liquid +++ b/modules/core/public/lib/validations/gpg.liquid @@ -1,5 +1,5 @@ {% liquid - assign valid_gpg = object[field_name]['key'] | is_valid_gpg + assign valid_gpg = object[field_name]['key'] | is_gpg_valid unless valid_gpg assign message = 'modules/core/validation.invalid_gpg' | t function c = 'modules/core/helpers/register_error', contract: c, field_name: field_name, message: message, key: key