Skip to content

Commit 5098cf4

Browse files
committed
Fix tests for newer mailpit where <> are disallowed in emails.
1 parent 9634e4d commit 5098cf4

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

config/schema.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ import "path"
246246
listen_backlog?: uint
247247
error_log_level: string | *"notice"
248248
api_user: {
249-
email_regex: string | *"\\A[^@\\s]+@[^@\\s]+\\.[^@\\s]+\\z"
249+
email_regex: string | *"\\A[^@<>\\s]+@[^@<>\\s]+\\.[^@<>\\s]+\\z"
250250
first_name_exclude_regex: string | *"(http|https|www|<|>|\\r|\\n)"
251251
last_name_exclude_regex: string | *"(http|https|www|<|>|\\r|\\n)"
252252
force_public_verify_email: bool | *false
@@ -256,7 +256,7 @@ import "path"
256256
username_is_email: bool | *true
257257
password_length_min: uint | *14
258258
password_length_max: uint | *72
259-
email_regex: string | *"\\A[^@\\s]+@[^@\\s]+\\.[^@\\s]+\\z"
259+
email_regex: string | *"\\A[^@<>\\s]+@[^@<>\\s]+\\.[^@<>\\s]+\\z"
260260
password_regex?: string
261261
login_header?: string
262262
login_footer?: string

test/apis/v1/users/test_create_welcome_email.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ def test_html_escaping
292292
response = Typhoeus.post("https://127.0.0.1:9081/api-umbrella/v1/users.json", http_options.deep_merge(non_admin_key_creator_api_key).deep_merge({
293293
:headers => { "Content-Type" => "application/x-www-form-urlencoded" },
294294
:body => {
295-
:user => FactoryBot.attributes_for(:api_user, :email => "foo<script>&[email protected]", :first_name => "Test&First", :last_name => "Test&Last"),
295+
:user => FactoryBot.attributes_for(:api_user, :email => "foo&[email protected]", :first_name => "Test&First", :last_name => "Test&Last"),
296296
:options => { :send_welcome_email => true },
297297
},
298298
}))
@@ -309,12 +309,12 @@ def test_html_escaping
309309
assert_match("Hi,</p>", message.fetch("HTML"))
310310
assert_match("Hi,", message.fetch("Text"))
311311

312-
assert_match("Your API key for <strong>foo&lt;script&gt;&amp;[email protected]</strong> is:</p>", message.fetch("HTML"))
313-
assert_match("Your API key for foo<script>&[email protected] is:", message.fetch("Text"))
312+
assert_match("Your API key for <strong>foo&amp;[email protected]</strong> is:</p>", message.fetch("HTML"))
313+
assert_match("Your API key for foo&[email protected] is:", message.fetch("Text"))
314314

315315
# Support footer
316-
assert_match("Account Email: foo&lt;script&gt;&amp;[email protected]", message.fetch("HTML"))
317-
assert_match("Account Email: foo<script>&[email protected]", message.fetch("Text"))
316+
assert_match("Account Email: foo&amp;[email protected]", message.fetch("HTML"))
317+
assert_match("Account Email: foo&[email protected]", message.fetch("Text"))
318318

319319
assert_match("Account ID: #{user.id}", message.fetch("HTML"))
320320
assert_match("Account ID: #{user.id}", message.fetch("Text"))

0 commit comments

Comments
 (0)