Skip to content

Commit 763bc05

Browse files
committed
Fix email commas.
1 parent f5181a1 commit 763bc05

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

app/lib/service/email/email_templates.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ bool isValidEmail(String email) {
8686
// strict pattern check
8787
if (!_strictEmailRegExp.hasMatch(email)) return false;
8888

89+
// also reject commas
90+
if (email.contains(',')) return false;
91+
8992
// checking for IPv4 or IPv6 addresses
9093
var isInternetAddress = false;
9194
try {

app/test/service/email/email_templates_test.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ void main() {
9898
// verify that we have rejected emails
9999
expect(rejectedEmails, hasLength(215));
100100
});
101+
102+
test('reject multiple addresses', () {
103+
expect(isValidEmail('[email protected],[email protected]'), false);
104+
});
101105
});
102106

103107
group('EmailAddress format', () {

0 commit comments

Comments
 (0)