Commit f0c44b5d authored by Douwe Maan's avatar Douwe Maan

Merge branch 'improve/invite-accept-page' into 'master'

Alert user when logged in user email is not the same as the invitation

## What does this MR do?

Add a note to the invitation page when the logged in user email is not the same as the invitation.

## Why was this MR needed?

Help users to not accept invitations logged in with a wrong account.

## Screenshots (if relevant)

![1](/uploads/78ac6d3db67c9ed60cf74a20ad240d0b/1.png)

## Relevant issues

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/24955

See merge request !7803
parents ef3a898d 6a7bc1c1
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
- if inviter = @member.created_by - if inviter = @member.created_by
by by
= link_to inviter.name, user_url(inviter) = link_to inviter.name, user_url(inviter)
to join to join
- case @member.source - case @member.source
- when Project - when Project
- project = @member.source - project = @member.source
...@@ -20,11 +20,18 @@ ...@@ -20,11 +20,18 @@
= link_to group.name, group_url(group) = link_to group.name, group_url(group)
as #{@member.human_access}. as #{@member.human_access}.
- if @member.source.users.include?(current_user) - is_member = @member.source.users.include?(current_user)
- if is_member
%p %p
However, you are already a member of this #{@member.source.is_a?(Group) ? "group" : "project"}. However, you are already a member of this #{@member.source.is_a?(Group) ? "group" : "project"}.
Sign in using a different account to accept the invitation. Sign in using a different account to accept the invitation.
- else
- if @member.invite_email != current_user.email
%p
Note that this invitation was sent to #{mail_to @member.invite_email}, but you are signed in as #{link_to current_user.to_reference, user_url(current_user)} with email #{mail_to current_user.email}.
- unless is_member
.actions .actions
= link_to "Accept invitation", accept_invite_url(@token), method: :post, class: "btn btn-success" = link_to "Accept invitation", accept_invite_url(@token), method: :post, class: "btn btn-success"
= link_to "Decline", decline_invite_url(@token), method: :post, class: "btn btn-danger prepend-left-10" = link_to "Decline", decline_invite_url(@token), method: :post, class: "btn btn-danger prepend-left-10"
---
title: Add note to the invite page when the logged in user email is not the same as the invitation
merge_request:
author:
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