diff --git a/app/forms/state_file/md_tax_refund_form.rb b/app/forms/state_file/md_tax_refund_form.rb index 8ccd2c6c36..75bacdfb61 100644 --- a/app/forms/state_file/md_tax_refund_form.rb +++ b/app/forms/state_file/md_tax_refund_form.rb @@ -25,8 +25,8 @@ class MdTaxRefundForm < QuestionsForm with_options unless: -> { payment_or_deposit_type == "mail" } do validates :account_holder_first_name, presence: true validates :account_holder_last_name, presence: true - validates :account_holder_first_name, format: { with: /\A[a-zA-Z]{1}([A-Za-z\-\s']{0,15})\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.first_name.invalid_format') }} - validates :account_holder_last_name, format: { with: /\A[a-zA-Z]{1}([A-Za-z\-\s']{0,31})\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.last_name.invalid_format') }} + validates :account_holder_first_name, format: { with: /\A([A-Za-z0-9'\-] ?)*[A-Za-z0-9'\-]{0,15}\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.first_name.invalid_format') }} + validates :account_holder_last_name, format: { with: /\A([A-Za-z0-9'\-] ?)*[A-Za-z0-9'\-]{0,31}\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.last_name.invalid_format') }} validates :account_holder_middle_initial, length: { maximum: 1 }, format: { with: /\A[A-Za-z]\z/.freeze, allow_blank: true } validates :account_holder_suffix, inclusion: { in: SUFFIX_OPTIONS }, allow_blank: true, if: -> { account_holder_suffix.present? } validates :account_type, presence: true @@ -46,8 +46,8 @@ class MdTaxRefundForm < QuestionsForm with_options if: -> { has_joint_account_holder == 'yes' } do validates :joint_account_holder_first_name, presence: true validates :joint_account_holder_last_name, presence: true - validates :joint_account_holder_first_name, format: { with: /\A[a-zA-Z]{1}([A-Za-z\-\s']{0,15})\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.first_name.invalid_format') }} - validates :joint_account_holder_last_name, format: { with: /\A[a-zA-Z]{1}([A-Za-z\-\s']{0,137})\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.last_name.invalid_format') }} + validates :joint_account_holder_first_name, format: { with: /\A([A-Za-z0-9'\-] ?)*[A-Za-z0-9'\-]{0,15}\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.first_name.invalid_format') }} + validates :joint_account_holder_last_name, format: { with: /\A([A-Za-z0-9'\-] ?)*[A-Za-z0-9'\-]{0,31}\z/.freeze, message: ->(_object, _data) { I18n.t('errors.attributes.last_name.invalid_format') }} validates :joint_account_holder_middle_initial, length: { maximum: 1 }, format: { with: /\A[A-Za-z]\z/.freeze, allow_blank: true } validates :joint_account_holder_suffix, inclusion: { in: SUFFIX_OPTIONS }, allow_blank: true, if: -> { joint_account_holder_suffix.present? } end diff --git a/config/locales/en.yml b/config/locales/en.yml index e2cf8814c5..177d7da4ff 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -171,7 +171,7 @@ en: format: Please enter an expiration date in the format MM-DD-2YYY. first_name: blank: Please enter a first name. - invalid_format: Only letters, hyphen, and apostrophe are accepted, and first name must be less than 16 characters. + invalid_format: Only letters, numbers, hyphen, and apostrophe are accepted, and first name must be less than 16 characters. hoh_qualifying_person_name: blank: Please double check your answers regarding how many months you lived with these dependents. Based on your federal return, you lived in a home with one of these dependents for at least half the year. intake_site: @@ -180,7 +180,7 @@ en: blank: Please select a number of jobs. last_name: blank: Please enter a last name. - invalid_format: Only letters, hyphen, and apostrophe are accepted, and last name must be less than 32 characters. + invalid_format: Only letters, numbers, hyphen, and apostrophe are accepted, and last name must be less than 32 characters. password: insecure: Add some more uncommon words to improve password strength. not_matching: The password provided does not match. diff --git a/config/locales/es.yml b/config/locales/es.yml index 55e9642a39..063351d2ac 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -172,7 +172,7 @@ es: format: Ingrese una fecha de vencimiento en el formato MM-DD-2YYY. first_name: blank: Por favor, ingrese un nombre. - invalid_format: Solo se aceptan letras, guiones y apóstrofos, y el nombre debe tener menos de 16 caracteres. + invalid_format: Solo se aceptan letras, números, guiones y apóstrofos, y el nombre debe tener menos de 16 caracteres. hoh_qualifying_person_name: blank: Por favor, revisa tus respuestas sobre cuántos meses viviste con estos dependientes. Según tu declaración federal, viviste en un hogar con al menos uno de estos dependientes durante al menos la mitad del año. intake_site: @@ -181,7 +181,7 @@ es: blank: Por favor, seleccione un número de trabajos. last_name: blank: Por favor, ingrese un apellido. - invalid_format: Solo se aceptan letras, guiones y apóstrofos, y el nombre debe tener menos de 32 caracteres. + invalid_format: Solo se aceptan letras, números, guiones y apóstrofos, y el nombre debe tener menos de 32 caracteres. password: insecure: Agregue algunas palabras más poco comunes para mejorar la seguridad de la contraseña. not_matching: Las contraseñas proporcionadas no coinciden. diff --git a/spec/forms/state_file/md_tax_refund_form_spec.rb b/spec/forms/state_file/md_tax_refund_form_spec.rb index 7262368987..9d9c037ee2 100644 --- a/spec/forms/state_file/md_tax_refund_form_spec.rb +++ b/spec/forms/state_file/md_tax_refund_form_spec.rb @@ -186,7 +186,7 @@ end context "has invalid account_holder params" do - let(:account_holder_first_name) { "A123456789101112131415A1234567891" } + let(:account_holder_first_name) { "A12345678_101112131415A1234567891" } let(:account_holder_middle_initial) { 'AB' } let(:account_holder_last_name) { "B'23%9" } let(:account_holder_suffix) { "SH" } @@ -230,7 +230,7 @@ end context "has invalid params" do - let(:joint_account_holder_first_name) { "A123456789101112131415A1234567891" } + let(:joint_account_holder_first_name) { "A12345678910(112131415A1234567891" } let(:joint_account_holder_middle_initial) { 'AB' } let(:joint_account_holder_last_name) { "B'23%9" } let(:joint_account_holder_suffix) { "SH" }