mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 04:08:41 +08:00
Add ability to run validation on site settings. notification_email and other email address settings are now validated.
This commit is contained in:
@ -21,4 +21,8 @@ class EmailValidator < ActiveModel::EachValidator
|
||||
value =~ regexp
|
||||
end
|
||||
|
||||
def self.email_regex
|
||||
/^[a-zA-Z0-9!#$%&'*+\/=?\^_`{|}~\-]+(?:\.[a-zA-Z0-9!#$%&'\*+\/=?\^_`{|}~\-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/
|
||||
end
|
||||
|
||||
end
|
Reference in New Issue
Block a user