Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117755619
D5670.1775203840.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
D5670.1775203840.diff
View Options
diff --git a/src/app/Rules/UserEmailDomain.php b/src/app/Rules/UserEmailDomain.php
--- a/src/app/Rules/UserEmailDomain.php
+++ b/src/app/Rules/UserEmailDomain.php
@@ -52,7 +52,8 @@
$domain = Str::lower($domain);
// Use email validator to validate the domain part
- $v = Validator::make(['email' => 'user@' . $domain], ['email' => 'required|email']);
+ // Note: The 'filter' validator does not allow IDN domains
+ $v = Validator::make(['email' => 'user@' . $domain], ['email' => 'required|email:filter']);
if ($v->fails()) {
$this->message = \trans('validation.domaininvalid');
return false;
diff --git a/src/tests/Unit/Rules/UserEmailDomainTest.php b/src/tests/Unit/Rules/UserEmailDomainTest.php
--- a/src/tests/Unit/Rules/UserEmailDomainTest.php
+++ b/src/tests/Unit/Rules/UserEmailDomainTest.php
@@ -39,6 +39,13 @@
$this->assertTrue($v->fails());
$this->assertSame(['domain' => ['The specified domain is invalid.']], $v->errors()->toArray());
+ // invalid domain (utf8)
+ // For now IDN domains aren't allowed because it seems ldap_add() fails (and who knows what else)
+ $v = Validator::make(['domain' => 'tİktok.com'], $rules);
+
+ $this->assertTrue($v->fails());
+ $this->assertSame(['domain' => ['The specified domain is invalid.']], $v->errors()->toArray());
+
// Valid domain
$domain = str_repeat('abcdefghi.', 18) . 'abcdefgh.pl'; // 191 chars
$v = Validator::make(['domain' => $domain], $rules);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 8:10 AM (4 h, 53 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823158
Default Alt Text
D5670.1775203840.diff (1 KB)
Attached To
Mode
D5670: Don't allow IDN domains
Attached
Detach File
Event Timeline