summaryrefslogtreecommitdiff
path: root/app/models/email.rb
diff options
context:
space:
mode:
authorBrett Walker <brett@digitalmoksha.com>2017-09-04 19:23:33 +0200
committerBrett Walker <brett@digitalmoksha.com>2017-09-23 15:23:11 +0200
commitf9f467227538df0ce2012df39dfdcf55fb260f94 (patch)
tree7ebabd8226e6db955d77ca456406197b6a8c0e6b /app/models/email.rb
parentb14641579855a14398db260ab909ae77c164c883 (diff)
downloadgitlab-ce-f9f467227538df0ce2012df39dfdcf55fb260f94.tar.gz
Send a confirmation email when the user adds a secondary email address. Utilizes the Devise `confirmable` capabilities. Issue #37385
Diffstat (limited to 'app/models/email.rb')
-rw-r--r--app/models/email.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/email.rb b/app/models/email.rb
index 826d4f16edb..6254d66cad9 100644
--- a/app/models/email.rb
+++ b/app/models/email.rb
@@ -7,6 +7,9 @@ class Email < ActiveRecord::Base
validates :email, presence: true, uniqueness: true, email: true
validate :unique_email, if: ->(email) { email.email_changed? }
+ devise :confirmable
+ self.reconfirmable = false # currently email can't be changed, no need to reconfirm
+
def email=(value)
write_attribute(:email, value.downcase.strip)
end