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

@ -12,6 +12,9 @@
.flash-message= t('admin.settings.registrations.moderation_recommandation')
.fields-group
= f.input :min_age, as: :string, wrapper: :with_block_label, input_html: { inputmode: 'numeric' }
.fields-row
.fields-row__column.fields-row__column-6.fields-group
= f.input :registrations_mode,

View file

@ -21,20 +21,19 @@
= f.simple_fields_for :account do |ff|
= ff.input :username,
append: "@#{site_hostname}",
input_html: { 'aria-label': t('simple_form.labels.defaults.username'), autocomplete: 'off', placeholder: t('simple_form.labels.defaults.username'), pattern: '[a-zA-Z0-9_]+', maxlength: Account::USERNAME_LENGTH_LIMIT },
label: false,
input_html: { autocomplete: 'off', pattern: '[a-zA-Z0-9_]+', maxlength: Account::USERNAME_LENGTH_LIMIT, placeholder: ' ' },
required: true,
wrapper: :with_label
= f.input :email,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.email'), autocomplete: 'username' },
placeholder: t('simple_form.labels.defaults.email'),
required: true
input_html: { autocomplete: 'username', placeholder: ' ' },
required: true,
wrapper: :with_label
= f.input :password,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.password'), autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last },
placeholder: t('simple_form.labels.defaults.password'),
required: true
input_html: { autocomplete: 'new-password', minlength: User.password_length.first, maxlength: User.password_length.last, placeholder: ' ' },
required: true,
wrapper: :with_label
= f.input :password_confirmation,
hint: false,
input_html: { 'aria-label': t('simple_form.labels.defaults.confirm_password'), autocomplete: 'new-password', maxlength: User.password_length.last },
@ -53,6 +52,14 @@
required: false,
wrapper: :with_label
- if Setting.min_age.present?
.fields-group
= f.input :date_of_birth,
as: :date_of_birth,
hint: t('simple_form.hints.user.date_of_birth', age: Setting.min_age.to_i),
required: true,
wrapper: :with_block_label
- if approved_registrations? && @invite.blank?
%p.lead= t('auth.sign_up.manual_review', domain: site_hostname)