summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorAlexis Reigel <mail@koffeinfrei.org>2017-02-28 15:25:12 +0100
committerAlexis Reigel <mail@koffeinfrei.org>2017-07-27 15:42:04 +0200
commit8bd94a7304d392ad030295b5dfcd84c0100eddd1 (patch)
tree0e08bcdb460ad21c25646f686a42f4b743bf0129 /app/models/user.rb
parentc1281982bd7975b45bed5b8e2c5ef5e242ea18fd (diff)
downloadgitlab-ce-8bd94a7304d392ad030295b5dfcd84c0100eddd1.tar.gz
remove gpg from keychain when user's email changes
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/app/models/user.rb b/app/models/user.rb
index 5aebd36cf8a..42c83e3d206 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -155,6 +155,7 @@ class User < ActiveRecord::Base
before_validation :set_public_email, if: :public_email_changed?
after_update :update_emails_with_primary_email, if: :email_changed?
+ after_update :synchronize_gpg_keys, if: :email_changed?
before_save :ensure_authentication_token, :ensure_incoming_email_token
before_save :ensure_user_rights_and_limits, if: :external_changed?
after_save :ensure_namespace_correct
@@ -1157,4 +1158,10 @@ class User < ActiveRecord::Base
ensure
Gitlab::ExclusiveLease.cancel(lease_key, uuid)
end
+
+ def synchronize_gpg_keys
+ gpg_keys.each do |gpg_key|
+ gpg_key.synchronize_keychain
+ end
+ end
end