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 |
Error After |
---|---|---|
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 |
Error After |
---|---|---|
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:
- 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 |
---|---|---|
- To restrict invited email adresses to Group only, Go to Group Settings > General and expand Permissions, LFS, 2FA (EE Only feature)
Screenshots (strongly suggested)
Restricted by: | Before | After |
---|---|---|
Add to Group:
members
API as admin
:
Before | After |
---|---|
single | single |
multiple | multiple: |
invitations
API as admin
:
Before | After |
---|---|
single API response: | single API response: |
multiple API response: | multiple API response: |
Add to Project:
/projects/:id/invitations
API as admin
:
Before | After |
---|---|
single API response: | single API response: |
multiple API response: | multiple API response: |
/projects/:id/invitations
API as non-admin
:
before | after |
---|---|
User validation error during signup:
before | after |
---|---|
To enable Invite Members modal locally
- Feature.enable(:invite_members_group_modal)
- Feature flag rollout issue: https://gitlab.com/gitlab-org/gitlab/-/issues/247208
Does this MR meet the acceptance criteria?
Conformity
- [-] I have included a changelog entry, or it's not needed. (Does this MR need a changelog?)
-
I have added/updated documentation, or it's not needed. (Is documentation required?) -
I have properly separated EE content from FOSS, or this MR is FOSS only. (Where should EE code go?) - [-] I have added information for database reviewers in the MR description, or it's not needed. (Does this MR have database related changes?)
-
I have self-reviewed this MR per code review guidelines. -
This MR does not harm performance, or I have asked a reviewer to help assess the performance impact. (Merge request performance guidelines) -
I have followed the style guides.
Availability and Testing
-
I have added/updated tests following the Testing Guide, or it's not needed. (Consider all test levels. See the Test Planning Process.) - [-] I have tested this MR in all supported browsers, or it's not needed.
- [-] I have informed the Infrastructure department of a default or new setting change per definition of done, or it's not needed.
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