diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-07-25 16:15:04 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-07-25 16:15:04 +0000 |
commit | a0779cbb34338425a9a7842454f03097d05d31ed (patch) | |
tree | 4bcc3ef5f9122b38cb34bfa79431126aa8dcf40d | |
parent | d8e759802ec28c89ab0b07d6d748748dda3254a6 (diff) | |
parent | 42d44009eed474d5ac70383175fcd652194a5b7b (diff) | |
download | gitlab-ce-a0779cbb34338425a9a7842454f03097d05d31ed.tar.gz |
Merge branch 'issue47716-email_confirmations-squash' into 'master'
fixes #47716 where email confirmation fails after adding additional emails
Closes #47716
See merge request gitlab-org/gitlab-ce!20084
-rw-r--r-- | app/models/email.rb | 4 | ||||
-rw-r--r-- | changelogs/unreleased/fix-email-confirmation-addtional-email.yml | 5 | ||||
-rw-r--r-- | spec/features/users/add_email_to_existing_account.rb | 15 |
3 files changed, 24 insertions, 0 deletions
diff --git a/app/models/email.rb b/app/models/email.rb index d6516761f0a..15bdedeac33 100644 --- a/app/models/email.rb +++ b/app/models/email.rb @@ -25,6 +25,10 @@ class Email < ActiveRecord::Base self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email) end + def accept_pending_invitations! + user.accept_pending_invitations! + end + # once email is confirmed, update the gpg signatures def update_invalid_gpg_signatures user.update_invalid_gpg_signatures if confirmed? diff --git a/changelogs/unreleased/fix-email-confirmation-addtional-email.yml b/changelogs/unreleased/fix-email-confirmation-addtional-email.yml new file mode 100644 index 00000000000..56a2efa4d60 --- /dev/null +++ b/changelogs/unreleased/fix-email-confirmation-addtional-email.yml @@ -0,0 +1,5 @@ +--- +title: Fix email confirmation bug when user adds additional email to account +merge_request: 20084 +author: muhammadn +type: fixed diff --git a/spec/features/users/add_email_to_existing_account.rb b/spec/features/users/add_email_to_existing_account.rb new file mode 100644 index 00000000000..4355f769429 --- /dev/null +++ b/spec/features/users/add_email_to_existing_account.rb @@ -0,0 +1,15 @@ +require 'spec_helper' + +describe 'AdditionalEmailToExistingAccount' do + describe 'add secondary email associated with account' do + let(:user) { create(:user) } + + it 'verifies confirmation of additional email' do + sign_in(user) + + email = create(:email, user: user) + visit email_confirmation_path(confirmation_token: email.confirmation_token) + expect(page).to have_content 'Your email address has been successfully confirmed.' + end + end +end |