Skip to content

Commit

Permalink
fix: Omniauth registration form
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentinchampenois committed Dec 6, 2023
1 parent 596a103 commit f856626
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ module OmniauthRegistrationFormExtend
:city,
:address,
:certification,
presence: true
presence: true, unless: ->(form) { form.certification.blank? }

validates :postal_code, numericality: { only_integer: true }, length: { is: 5 }
validates :certification, acceptance: true
validates :postal_code, numericality: { only_integer: true }, length: { is: 5 }, unless: ->(form) { form.certification.blank? }
validates :certification, acceptance: true, presence: true
validate :over_16?

private
Expand All @@ -31,6 +31,7 @@ def over_16?
return if 16.years.ago.to_date > birth_date

errors.add :base, I18n.t("decidim.devise.registrations.form.errors.messages.over_16")
errors.add :birth_date, I18n.t("decidim.devise.registrations.form.errors.messages.over_16")
end
end
end
Expand Down

0 comments on commit f856626

Please sign in to comment.