Commit a0779cbb authored by Douwe Maan's avatar Douwe Maan

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
parents d8e75980 42d44009
...@@ -25,6 +25,10 @@ class Email < ActiveRecord::Base ...@@ -25,6 +25,10 @@ class Email < ActiveRecord::Base
self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email) self.errors.add(:email, 'has already been taken') if User.exists?(email: self.email)
end end
def accept_pending_invitations!
user.accept_pending_invitations!
end
# once email is confirmed, update the gpg signatures # once email is confirmed, update the gpg signatures
def update_invalid_gpg_signatures def update_invalid_gpg_signatures
user.update_invalid_gpg_signatures if confirmed? user.update_invalid_gpg_signatures if confirmed?
......
---
title: Fix email confirmation bug when user adds additional email to account
merge_request: 20084
author: muhammadn
type: fixed
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment