forked from e621ng/e621ng
[Users] Add a reasonable length limit on emails
The spec allows for addresses up to 255. A limit of 100 impacts 3 users right now
This commit is contained in:
parent
5f6fa2b83d
commit
0dce1e50f2
@ -62,6 +62,7 @@ class User < ApplicationRecord
|
|||||||
validates :email, presence: { if: :enable_email_verification? }
|
validates :email, presence: { if: :enable_email_verification? }
|
||||||
validates :email, uniqueness: { case_sensitive: false, if: :enable_email_verification? }
|
validates :email, uniqueness: { case_sensitive: false, if: :enable_email_verification? }
|
||||||
validates :email, format: { with: /\A.+@[^ ,;@]+\.[^ ,;@]+\z/, if: :enable_email_verification? }
|
validates :email, format: { with: /\A.+@[^ ,;@]+\.[^ ,;@]+\z/, if: :enable_email_verification? }
|
||||||
|
validates :email, length: { maximum: 100 }
|
||||||
validate :validate_email_address_allowed, on: [:create, :update], if: ->(rec) { (rec.new_record? && rec.email.present?) || (rec.email.present? && rec.email_changed?) }
|
validate :validate_email_address_allowed, on: [:create, :update], if: ->(rec) { (rec.new_record? && rec.email.present?) || (rec.email.present? && rec.email_changed?) }
|
||||||
|
|
||||||
validates :name, user_name: true, on: :create
|
validates :name, user_name: true, on: :create
|
||||||
|
Loading…
Reference in New Issue
Block a user