Commit f2918f64 authored by Phil Hughes's avatar Phil Hughes

Fixes email invites being case senstive

Fixes a bug when accepting an email invite it would
require both the invited email and the users email
to match case.

Changelog: fixed

Closes https://gitlab.com/gitlab-org/gitlab/-/issues/338022
parent b05150f7
...@@ -52,7 +52,7 @@ class InvitesController < ApplicationController ...@@ -52,7 +52,7 @@ class InvitesController < ApplicationController
end end
def current_user_matches_invite? def current_user_matches_invite?
current_user.verified_emails.include?(@member.invite_email) current_user.verified_email?(@member.invite_email)
end end
def member? def member?
......
...@@ -103,6 +103,20 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do ...@@ -103,6 +103,20 @@ RSpec.describe 'Group or Project invitations', :aggregate_failures do
expect(page).to have_content('You are already a member of this group.') expect(page).to have_content('You are already a member of this group.')
end end
end end
context 'when email case doesnt match', :js do
let(:invite_email) { 'User@example.com' }
let(:user) { create(:user, email: 'user@example.com') }
before do
sign_in(user)
visit invite_path(group_invite.raw_invite_token)
end
it 'accepts invite' do
expect(page).to have_content('You have been granted Developer access to group Owned.')
end
end
end end
context 'when declining the invitation from invitation reminder email' do context 'when declining the invitation from invitation reminder email' do
......
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