Commit f31aea17 authored by Douwe Maan's avatar Douwe Maan

Merge branch '52940-fix-internal-email-pattern-not-respected' into 'master'

Fix a bug where internal email pattern wasn't respected

Closes #52940

See merge request gitlab-org/gitlab-ce!22516
parents bc72b2f1 1f0502df
...@@ -95,10 +95,6 @@ module Users ...@@ -95,10 +95,6 @@ module Users
if params[:reset_password] if params[:reset_password]
user_params.merge!(force_random_password: true, password_expires_at: nil) user_params.merge!(force_random_password: true, password_expires_at: nil)
end end
if user_default_internal_regex_enabled? && !user_params.key?(:external)
user_params[:external] = user_external?
end
else else
allowed_signup_params = signup_params allowed_signup_params = signup_params
allowed_signup_params << :skip_confirmation if skip_authorization allowed_signup_params << :skip_confirmation if skip_authorization
...@@ -109,6 +105,10 @@ module Users ...@@ -109,6 +105,10 @@ module Users
end end
end end
if user_default_internal_regex_enabled? && !user_params.key?(:external)
user_params[:external] = user_external?
end
user_params user_params
end end
......
---
title: Fix a bug where internal email pattern wasn't respected
merge_request: 22516
author:
type: fixed
...@@ -159,9 +159,9 @@ describe Users::BuildService do ...@@ -159,9 +159,9 @@ describe Users::BuildService do
true | true | 'fl@example.com' | '' | true true | true | 'fl@example.com' | '' | true
true | false | 'fl@example.com' | '' | true true | false | 'fl@example.com' | '' | true
true | nil | 'fl@example.com' | '^(?:(?!\.ext@).)*$\r?' | true true | nil | 'fl@example.com' | '^(?:(?!\.ext@).)*$\r?' | false
true | true | 'fl@example.com' | '^(?:(?!\.ext@).)*$\r?' | true true | true | 'fl@example.com' | '^(?:(?!\.ext@).)*$\r?' | false
true | false | 'fl@example.com' | '^(?:(?!\.ext@).)*$\r?' | true true | false | 'fl@example.com' | '^(?:(?!\.ext@).)*$\r?' | false
true | nil | 'tester.ext@domain.com' | '^(?:(?!\.ext@).)*$\r?' | true true | nil | 'tester.ext@domain.com' | '^(?:(?!\.ext@).)*$\r?' | true
true | true | 'tester.ext@domain.com' | '^(?:(?!\.ext@).)*$\r?' | true true | true | 'tester.ext@domain.com' | '^(?:(?!\.ext@).)*$\r?' | true
......
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