From f9f467227538df0ce2012df39dfdcf55fb260f94 Mon Sep 17 00:00:00 2001 From: Brett Walker Date: Mon, 4 Sep 2017 19:23:33 +0200 Subject: Send a confirmation email when the user adds a secondary email address. Utilizes the Devise `confirmable` capabilities. Issue #37385 --- app/models/email.rb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/models/email.rb') 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 -- cgit v1.2.3