Commit 1cbb0a60 authored by nicolasdular's avatar nicolasdular

Remove email restrictions feature flag

Removes the feature flag and introduces email restrictions via
regular expressions as a setting for GitLab instance
administrators.
parent 8b279be5
...@@ -1786,7 +1786,6 @@ class User < ApplicationRecord ...@@ -1786,7 +1786,6 @@ class User < ApplicationRecord
end end
def check_email_restrictions def check_email_restrictions
return unless Feature.enabled?(:email_restrictions)
return unless Gitlab::CurrentSettings.email_restrictions_enabled? return unless Gitlab::CurrentSettings.email_restrictions_enabled?
restrictions = Gitlab::CurrentSettings.email_restrictions restrictions = Gitlab::CurrentSettings.email_restrictions
......
...@@ -49,20 +49,19 @@ ...@@ -49,20 +49,19 @@
= f.label :domain_blacklist, 'Blacklisted domains for sign-ups', class: 'label-bold' = f.label :domain_blacklist, 'Blacklisted domains for sign-ups', class: 'label-bold'
= f.text_area :domain_blacklist_raw, placeholder: 'domain.com', class: 'form-control', rows: 8 = f.text_area :domain_blacklist_raw, placeholder: 'domain.com', class: 'form-control', rows: 8
.form-text.text-muted Users with e-mail addresses that match these domain(s) will NOT be able to sign-up. Wildcards allowed. Use separate lines for multiple entries. Ex: domain.com, *.domain.com .form-text.text-muted Users with e-mail addresses that match these domain(s) will NOT be able to sign-up. Wildcards allowed. Use separate lines for multiple entries. Ex: domain.com, *.domain.com
- if Feature.enabled?(:email_restrictions) .form-group
.form-group = f.label :email_restrictions_enabled, _('Email restrictions'), class: 'label-bold'
= f.label :email_restrictions_enabled, _('Email restrictions'), class: 'label-bold' .form-check
.form-check = f.check_box :email_restrictions_enabled, class: 'form-check-input'
= f.check_box :email_restrictions_enabled, class: 'form-check-input' = f.label :email_restrictions_enabled, class: 'form-check-label' do
= f.label :email_restrictions_enabled, class: 'form-check-label' do = _('Enable email restrictions for sign ups')
= _('Enable email restrictions for sign ups') .form-group
.form-group = f.label :email_restrictions, _('Email restrictions for sign-ups'), class: 'label-bold'
= f.label :email_restrictions, _('Email restrictions for sign-ups'), class: 'label-bold' = f.text_area :email_restrictions, class: 'form-control', rows: 4
= f.text_area :email_restrictions, class: 'form-control', rows: 4 .form-text.text-muted
.form-text.text-muted - supported_syntax_link_url = 'https://github.com/google/re2/wiki/Syntax'
- supported_syntax_link_url = 'https://github.com/google/re2/wiki/Syntax' - supported_syntax_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: supported_syntax_link_url }
- supported_syntax_link_start = '<a href="%{url}" target="_blank" rel="noopener noreferrer">'.html_safe % { url: supported_syntax_link_url } = _('Restricts sign-ups for email addresses that match the given regex. See the %{supported_syntax_link_start}supported syntax%{supported_syntax_link_end} for more information.').html_safe % { supported_syntax_link_start: supported_syntax_link_start, supported_syntax_link_end: '</a>'.html_safe }
= _('Restricts sign-ups for email addresses that match the given regex. See the %{supported_syntax_link_start}supported syntax%{supported_syntax_link_end} for more information.').html_safe % { supported_syntax_link_start: supported_syntax_link_start, supported_syntax_link_end: '</a>'.html_safe }
.form-group .form-group
= f.label :after_sign_up_text, class: 'label-bold' = f.label :after_sign_up_text, class: 'label-bold'
......
---
title: Add option to restrict emails that match a configured regular expression
merge_request: 30548
author:
type: added
...@@ -538,18 +538,6 @@ describe User, :do_not_mock_admin_mode do ...@@ -538,18 +538,6 @@ describe User, :do_not_mock_admin_mode do
expect(user).to be_valid expect(user).to be_valid
end end
context 'when feature flag is turned off' do
before do
stub_feature_flags(email_restrictions: false)
end
it 'does accept the email address' do
user = build(:user, email: 'info+1@test.com')
expect(user).to be_valid
end
end
context 'when created_by_id is set' do context 'when created_by_id is set' do
it 'does accept the email address' do it 'does accept the email address' do
user = build(:user, email: 'info+1@test.com', created_by_id: 1) user = build(:user, email: 'info+1@test.com', created_by_id: 1)
......
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