mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add a way to validate min and max value of an integer site setting
This commit is contained in:
@@ -1,9 +1,13 @@
|
||||
class EmailSettingValidator
|
||||
def self.valid_value?(val)
|
||||
def initialize(opts={})
|
||||
@opts = opts
|
||||
end
|
||||
|
||||
def valid_value?(val)
|
||||
!val.present? || !!(EmailValidator.email_regex =~ val)
|
||||
end
|
||||
|
||||
def self.error_message(val)
|
||||
def error_message(val)
|
||||
I18n.t('site_settings.errors.invalid_email')
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user