summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
Diffstat (limited to 'app/models')
-rw-r--r--app/models/application_setting.rb4
-rw-r--r--app/models/email.rb2
-rw-r--r--app/models/member.rb4
-rw-r--r--app/models/user.rb7
4 files changed, 7 insertions, 10 deletions
diff --git a/app/models/application_setting.rb b/app/models/application_setting.rb
index fa48fe5b9e4..ac6653f5d50 100644
--- a/app/models/application_setting.rb
+++ b/app/models/application_setting.rb
@@ -71,8 +71,8 @@ class ApplicationSetting < ActiveRecord::Base
url: true
validates :admin_notification_email,
- allow_blank: true,
- email: true
+ format: { with: Devise.email_regexp },
+ allow_blank: true
validates :two_factor_grace_period,
numericality: { greater_than_or_equal_to: 0 }
diff --git a/app/models/email.rb b/app/models/email.rb
index 935705e2ed4..daa259ee2d2 100644
--- a/app/models/email.rb
+++ b/app/models/email.rb
@@ -15,7 +15,7 @@ class Email < ActiveRecord::Base
belongs_to :user
validates :user_id, presence: true
- validates :email, presence: true, email: { strict_mode: true }, uniqueness: true
+ validates :email, presence: true, uniqueness: true, format: { with: Devise.email_regexp }
validate :unique_email, if: ->(email) { email.email_changed? }
before_validation :cleanup_email
diff --git a/app/models/member.rb b/app/models/member.rb
index 34efcd0088d..0b6785ddbc5 100644
--- a/app/models/member.rb
+++ b/app/models/member.rb
@@ -38,8 +38,8 @@ class Member < ActiveRecord::Base
presence: {
if: :invite?
},
- email: {
- strict_mode: true,
+ format: {
+ with: Devise.email_regexp,
allow_nil: true
},
uniqueness: {
diff --git a/app/models/user.rb b/app/models/user.rb
index 234c1cd89f9..edda0ebef86 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -146,11 +146,8 @@ class User < ActiveRecord::Base
# Validations
#
validates :name, presence: true
- # Note that a 'uniqueness' and presence check is provided by devise :validatable for email. We do not need to
- # duplicate that here as the validation framework will have duplicate errors in the event of a failure.
- validates :email, presence: true, email: { strict_mode: true }
- validates :notification_email, presence: true, email: { strict_mode: true }
- validates :public_email, presence: true, email: { strict_mode: true }, allow_blank: true, uniqueness: true
+ validates :notification_email, presence: true, format: { with: Devise.email_regexp }
+ validates :public_email, presence: true, uniqueness: true, format: { with: Devise.email_regexp }, allow_blank: true
validates :bio, length: { maximum: 255 }, allow_blank: true
validates :projects_limit, presence: true, numericality: { greater_than_or_equal_to: 0 }
validates :username,