diff options
author | Brett Walker <brett@digitalmoksha.com> | 2017-09-11 19:12:57 +0200 |
---|---|---|
committer | Brett Walker <brett@digitalmoksha.com> | 2017-09-23 15:24:53 +0200 |
commit | a9b31786971d83c193a1430df7c5c4550ba5aa6b (patch) | |
tree | f44fc10f5eb558644dfa3e246d88e3b721ebd03d /app/models | |
parent | 4457ae827251904c28a30c3db06e05495a42b484 (diff) | |
download | gitlab-ce-a9b31786971d83c193a1430df7c5c4550ba5aa6b.tar.gz |
Make GPG signature verification work with non-primary email (#36959)
Diffstat (limited to 'app/models')
-rw-r--r-- | app/models/user.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/app/models/user.rb b/app/models/user.rb index 09c9b3250eb..cdc7c8ad84a 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -817,6 +817,17 @@ class User < ActiveRecord::Base all_emails end + def all_verified_emails + verified_emails = [] + verified_emails << email if confirmed? && !temp_oauth_email? + verified_emails.concat(emails.select {|e| e.confirmed?}.map(&:email)) + verified_emails + end + + def verified_email?(email) + all_verified_emails.include?(email) + end + def hook_attrs { name: name, @@ -1041,10 +1052,6 @@ class User < ActiveRecord::Base ensure_rss_token! end - def verified_email?(email) - self.email == email - end - def sync_attribute?(attribute) return true if ldap_user? && attribute == :email |