summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorHoratiu Eugen Vlad <horatiu@vlad.eu>2018-10-27 00:39:00 +0200
committerHoratiu Eugen Vlad <horatiu@vlad.eu>2019-03-05 19:56:01 +0000
commitc8c0ea6c52d46ce63d838d1e739355d4deace434 (patch)
treea91cbe57b1cc4235f3be6b32f2829e200c73de09 /app/models/user.rb
parent60876192f89e41494cb56e2dc0a90f5f0dbfa716 (diff)
downloadgitlab-ce-c8c0ea6c52d46ce63d838d1e739355d4deace434.tar.gz
Align EmailValidator to validate_email gem implementation.
Renamed EmailValidator to DeviseEmailValidator to avoid 'email:' naming collision with ActiveModel::Validations::EmailValidator in 'validates' statement. Make use of the options attribute of the parent class ActiveModel::EachValidator. Add more options: regex.
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 9c091ac366c..14cedd9c4d1 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -162,9 +162,9 @@ class User < ApplicationRecord
validates :name, presence: true
validates :email, confirmation: true
validates :notification_email, presence: true
- validates :notification_email, email: true, if: ->(user) { user.notification_email != user.email }
- validates :public_email, presence: true, uniqueness: true, email: true, allow_blank: true
- validates :commit_email, email: true, allow_nil: true, if: ->(user) { user.commit_email != user.email }
+ validates :notification_email, devise_email: true, if: ->(user) { user.notification_email != user.email }
+ validates :public_email, presence: true, uniqueness: true, devise_email: true, allow_blank: true
+ validates :commit_email, devise_email: true, allow_nil: true, if: ->(user) { user.commit_email != user.email }
validates :bio, length: { maximum: 255 }, allow_blank: true
validates :projects_limit,
presence: true,