Add age verification on sign-up (#34150)

This commit is contained in:
Eugen Rochko 2025-03-14 15:07:29 +01:00 committed by GitHub
parent 4a6cf67c46
commit d213c585ff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 268 additions and 38 deletions

View file

@ -39,12 +39,14 @@ class Form::AdminSettings
authorized_fetch
app_icon
favicon
min_age
).freeze
INTEGER_KEYS = %i(
media_cache_retention_period
content_cache_retention_period
backups_retention_period
min_age
).freeze
BOOLEAN_KEYS = %i(
@ -88,6 +90,7 @@ class Form::AdminSettings
validates :show_domain_blocks, inclusion: { in: %w(disabled users all) }, if: -> { defined?(@show_domain_blocks) }
validates :show_domain_blocks_rationale, inclusion: { in: %w(disabled users all) }, if: -> { defined?(@show_domain_blocks_rationale) }
validates :media_cache_retention_period, :content_cache_retention_period, :backups_retention_period, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@media_cache_retention_period) || defined?(@content_cache_retention_period) || defined?(@backups_retention_period) }
validates :min_age, numericality: { only_integer: true }, allow_blank: true, if: -> { defined?(@min_age) }
validates :site_short_description, length: { maximum: DESCRIPTION_LIMIT }, if: -> { defined?(@site_short_description) }
validates :status_page_url, url: true, allow_blank: true
validate :validate_site_uploads