Skip to content

Change modal error message for restricted emails

What does this MR do?

Modifies the API response message and field validation error messages for restricted signup email address errors, which are also returned by the members and invitations APIs, which are parsed and displayed inside the Invite Members modal error alert.

The message is different depending on:

  • whether it is an invite to a group or to a project being restricted
  • whether the page viewer is able to administer the group/project or not
  • for admins, whether the error came from one of the 3 Admin signup restrictions, or the Group setting permissions (for groups, EE Only)

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/321706

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/325147

Requires !56957 (merged)

Requires !64807 (merged)

For Group

Error Before Error After 🆕 (inviting as nonadmin) Error After 🆕 (inviting as admin)
User email does not match the allowed domains: restricted-example.com, also-restricted.com, restricted2.example.org The member's email address is not allowed for this group. Check with your administrator. The member's email address is not allowed for this group. Go to the group’s Settings > General page, and check Restrict membership by email domain.

For project:

Error Before Error After 🆕 (inviting as nonadmin) Error After 🆕 (inviting as admin)
User domain is not authorized for signup The member's email address is not allowed for this project. Check with your administrator. The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check Allowed domains for sign-ups.
User is not from an allowed domain The member's email address is not allowed for this project. Check with your administrator. The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check the Domain denylist.
User domain is not allowed. Try again with a different email address, or contact your GitLab admin. The member's email address is not allowed for this project. Check with your administrator. The member's email address is not allowed for this project. Go to the Admin area > Sign-up restrictions, and check Email restrictions for sign-ups.
User email does not match the allowed domains: restricted-example.com, also-restricted.com, restricted2.example.org The member's email address is not allowed for this project. Check with your administrator. The member's email address is not allowed for this project. Go to the group’s Settings > General page, and check Restrict membership by email domain.

To enable restricted email domains for testing:

  1. To restrict invited email addresses to all Projects and all Groups, Go to Admin Area > Settings > General and expand Sign-up restrictions.
1. Allowed domains for sign-ups 2. Domain denylist 3. Email restrictions for sign-ups
allowed_domains_for_signup denied_domains_for_sign_ups email_restrictions_for_signups
  1. To restrict invited email adresses to Group only, Go to Group Settings > General and expand Permissions, LFS, 2FA (EE Only feature)

Screen_Shot_2021-09-01_at_7.01.06_PM

Screenshots (strongly suggested)

Restricted by: Before After
admin-domain-denylist admin-domain-denylist-before admin-domain-denylist-after
admin_allowed-domains-for-sign-up admin_allowed-domains-for-signup-before admin-allowed-domains-for-sign-up-after
admin-email-restrictions admin-email-restrictions-before admin-email-restrictions-after
group-restrict group-restrict-befor group-restrict-after

Add to Group:

members API as admin:

Before After
single single-before single s2-2-1
multiple multiple-before multiple: s2-2

invitations API as admin:

Before After
single API response: inv-single-before single API response: a1
multiple API response: inv-multiple-before multiple API response: a2

Add to Project:

/projects/:id/invitations API as admin:

Before After
single API response: Screen_Shot_2021-09-01_at_8.57.07_PM single API response: inv-proj-single
multiple API response: Screen_Shot_2021-09-01_at_8.57.29_PM multiple API response: inv-proj-multiple

/projects/:id/invitations API as non-admin:

before after
before-project after-project

User validation error during signup:

before after
b3 after

To enable Invite Members modal locally

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team

Related to #321706

Edited by Mayra Cabrera

Merge request reports