Skip to content
Snippets Groups Projects
Commit 97c71012 authored by Jarka Košanová's avatar Jarka Košanová :three:
Browse files

Merge branch '410038-remove-ff' into 'master'

Remove password_reset_any_verified_email FF

See merge request gitlab-org/gitlab!122038



Merged-by: Jarka Košanová's avatarJarka Košanová <jarka@gitlab.com>
Approved-by: default avatarNatalia Tepluhina <ntepluhina@gitlab.com>
Approved-by: Deepika Guliani's avatarDeepika Guliani <dguliani@gitlab.com>
Approved-by: Jessie Young's avatarJessie Young <jessieyoung@gitlab.com>
parents 5f2e4602 a935d28f
No related branches found
No related tags found
No related merge requests found
...@@ -7,8 +7,6 @@ module RecoverableByAnyEmail ...@@ -7,8 +7,6 @@ module RecoverableByAnyEmail
class_methods do class_methods do
def send_reset_password_instructions(attributes = {}) def send_reset_password_instructions(attributes = {})
return super unless Feature.enabled?(:password_reset_any_verified_email)
email = attributes.delete(:email) email = attributes.delete(:email)
super unless email super unless email
...@@ -27,8 +25,6 @@ def by_email_with_errors(email) ...@@ -27,8 +25,6 @@ def by_email_with_errors(email)
end end
def send_reset_password_instructions(opts = {}) def send_reset_password_instructions(opts = {})
return super() unless Feature.enabled?(:password_reset_any_verified_email)
token = set_reset_password_token token = set_reset_password_token
send_reset_password_instructions_notification(token, opts) send_reset_password_instructions_notification(token, opts)
...@@ -38,8 +34,6 @@ def send_reset_password_instructions(opts = {}) ...@@ -38,8 +34,6 @@ def send_reset_password_instructions(opts = {})
private private
def send_reset_password_instructions_notification(token, opts = {}) def send_reset_password_instructions_notification(token, opts = {})
return super(token) unless Feature.enabled?(:password_reset_any_verified_email)
send_devise_notification(:reset_password_instructions, token, opts) send_devise_notification(:reset_password_instructions, token, opts)
end end
end end
...@@ -7,10 +7,7 @@ ...@@ -7,10 +7,7 @@
= f.label :email, class: ("gl-mb-1" if Feature.enabled?(:restyle_login_page)) = f.label :email, class: ("gl-mb-1" if Feature.enabled?(:restyle_login_page))
= f.email_field :email, class: "form-control gl-form-input", required: true, autocomplete: 'off', value: params[:user_email], autofocus: true, title: _('Please provide a valid email address.') = f.email_field :email, class: "form-control gl-form-input", required: true, autocomplete: 'off', value: params[:user_email], autofocus: true, title: _('Please provide a valid email address.')
.form-text.text-muted .form-text.text-muted
- if Feature.enabled?(:password_reset_any_verified_email) = _('Requires a verified GitLab email address.')
= _('Requires a verified GitLab email address.')
- else
= _('Requires your primary GitLab email address.')
- if recaptcha_enabled? - if recaptcha_enabled?
.gl-px-5 .gl-px-5
......
---
name: password_reset_any_verified_email
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/119231
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/410038
milestone: '16.0'
type: development
group: group::authentication and authorization
default_enabled: true
...@@ -34,11 +34,7 @@ ...@@ -34,11 +34,7 @@
let_it_be(:verified_email) { create(:email, :confirmed, user: user, email: 'second@example.com') } let_it_be(:verified_email) { create(:email, :confirmed, user: user, email: 'second@example.com') }
let_it_be(:unverified_email) { create(:email, user: user, email: 'unverified@example.com') } let_it_be(:unverified_email) { create(:email, user: user, email: 'unverified@example.com') }
let(:ff_enabled) { true }
before do before do
stub_feature_flags(password_reset_any_verified_email: ff_enabled)
perform_enqueued_jobs do perform_enqueued_jobs do
visit new_user_password_path visit new_user_password_path
fill_in 'user_email', with: email fill_in 'user_email', with: email
...@@ -57,18 +53,8 @@ ...@@ -57,18 +53,8 @@
context 'when user enters a secondary verified email' do context 'when user enters a secondary verified email' do
let(:email) { verified_email.email } let(:email) { verified_email.email }
context 'when password_reset_any_verified_email FF is enabled' do it 'send the email to the correct email address' do
it 'send the email to the correct email address' do expect(ActionMailer::Base.deliveries.first.to).to include(email)
expect(ActionMailer::Base.deliveries.first.to).to include(email)
end
end
context 'when password_reset_any_verified_email FF is not enabled' do
let(:ff_enabled) { false }
it 'does not send an email' do
expect(ActionMailer::Base.deliveries.count).to eq(0)
end
end end
end end
......
...@@ -8,12 +8,6 @@ ...@@ -8,12 +8,6 @@
let_it_be(:verified_email) { create(:email, :confirmed, user: user) } let_it_be(:verified_email) { create(:email, :confirmed, user: user) }
let_it_be(:unverified_email) { create(:email, user: user) } let_it_be(:unverified_email) { create(:email, user: user) }
let(:ff_enabled) { true }
before do
stub_feature_flags(password_reset_any_verified_email: ff_enabled)
end
subject(:send_reset_password_instructions) do subject(:send_reset_password_instructions) do
User.send_reset_password_instructions(email: email) User.send_reset_password_instructions(email: email)
end end
...@@ -50,15 +44,7 @@ ...@@ -50,15 +44,7 @@
context 'with user verified email' do context 'with user verified email' do
let(:email) { verified_email.email } let(:email) { verified_email.email }
context 'when password_reset_any_verified_email FF is enabled' do it_behaves_like 'sends the password reset email'
it_behaves_like 'sends the password reset email'
end
context 'when password_reset_any_verified_email FF is not enabled' do
let(:ff_enabled) { false }
it_behaves_like 'does not send the password reset email'
end
end end
context 'with user unverified email' do context 'with user unverified email' do
...@@ -74,40 +60,23 @@ ...@@ -74,40 +60,23 @@
let_it_be(:token) { 'passwordresettoken' } let_it_be(:token) { 'passwordresettoken' }
before do before do
stub_feature_flags(password_reset_any_verified_email: ff_enabled)
allow(user).to receive(:set_reset_password_token).and_return(token) allow(user).to receive(:set_reset_password_token).and_return(token)
end end
subject { user.send_reset_password_instructions(opts) } subject { user.send_reset_password_instructions(opts) }
context 'when password_reset_any_verified_email FF is not enabled' do it 'sends the email' do
let(:ff_enabled) { false } expect { subject }.to have_enqueued_mail(DeviseMailer, :reset_password_instructions)
# original Devise behavior
it 'calls send_reset_password_instructions_notification just with token' do
expect(user).to receive(:send_reset_password_instructions_notification).with(token)
subject
end
end end
context 'when password_reset_any_verified_email FF is enabled' do it 'calls send_reset_password_instructions_notification with correct arguments' do
let(:ff_enabled) { true } expect(user).to receive(:send_reset_password_instructions_notification).with(token, opts)
it 'sends the email' do
expect { subject }.to have_enqueued_mail(DeviseMailer, :reset_password_instructions)
end
it 'calls send_reset_password_instructions_notification with correct arguments' do subject
expect(user).to receive(:send_reset_password_instructions_notification).with(token, opts) end
subject
end
it 'returns the generated token' do it 'returns the generated token' do
expect(subject).to eq(token) expect(subject).to eq(token)
end
end end
end end
end end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment