summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/email.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/email.rb b/app/models/email.rb
index 6254d66cad9..085663a4fef 100644
--- a/app/models/email.rb
+++ b/app/models/email.rb
@@ -7,6 +7,8 @@ class Email < ActiveRecord::Base
validates :email, presence: true, uniqueness: true, email: true
validate :unique_email, if: ->(email) { email.email_changed? }
+ after_commit :update_invalid_gpg_signatures, if: -> { previous_changes.key?('confirmed_at') }
+
devise :confirmable
self.reconfirmable = false # currently email can't be changed, no need to reconfirm
@@ -17,4 +19,9 @@ class Email < ActiveRecord::Base
def unique_email
self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email)
end
+
+ # once email is confirmed, update the gpg signatures
+ def update_invalid_gpg_signatures
+ user.update_invalid_gpg_signatures if confirmed?
+ end
end