0
0
Fork 0

Add time zone preference (#25342)

This commit is contained in:
Eugen Rochko 2023-06-10 03:29:37 +02:00 committed by GitHub
parent 16dd3f08c1
commit 4c9406bdb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 32 additions and 17 deletions

View file

@ -40,6 +40,7 @@
# sign_up_ip :inet
# role_id :bigint(8)
# settings :text
# time_zone :string
#
class User < ApplicationRecord
@ -99,6 +100,7 @@ class User < ApplicationRecord
validates_with BlacklistedEmailValidator, if: -> { ENV['EMAIL_DOMAIN_LISTS_APPLY_AFTER_CONFIRMATION'] == 'true' || !confirmed? }
validates_with EmailMxValidator, if: :validate_email_dns?
validates :agreement, acceptance: { allow_nil: false, accept: [true, 'true', '1'] }, on: :create
validates :time_zone, inclusion: { in: ActiveSupport::TimeZone.all.map { |tz| tz.tzinfo.name } }, allow_blank: true
# Honeypot/anti-spam fields
attr_accessor :registration_form_time, :website, :confirm_password