Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F117761578
D5637.1775214747.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
3 KB
Referenced Files
None
Subscribers
None
D5637.1775214747.diff
View Options
diff --git a/src/app/Rules/UserEmailLocal.php b/src/app/Rules/UserEmailLocal.php
--- a/src/app/Rules/UserEmailLocal.php
+++ b/src/app/Rules/UserEmailLocal.php
@@ -9,6 +9,11 @@
{
private $message;
private $external;
+ private $blacklist = [
+ // These are special names in Cyrus IMAP
+ 'anonymous',
+ 'anyone',
+ ];
/**
* Class constructor.
@@ -48,6 +53,15 @@
return false;
}
+ // Global blacklist, e.g. for keywords reserved in the backend(s)
+ // TODO: This should not be done when checking aliases or groups (they don't create a mailbox)
+ foreach ($this->blacklist as $entry) {
+ if (strcasecmp($login, $entry) == 0) {
+ $this->message = \trans('validation.entryexists', ['attribute' => $attribute]);
+ return false;
+ }
+ }
+
// Check if the local part is not one of exceptions
// (when creating an account/alias in a public domain)
if (!$this->external) {
diff --git a/src/tests/Feature/Controller/SignupTest.php b/src/tests/Feature/Controller/SignupTest.php
--- a/src/tests/Feature/Controller/SignupTest.php
+++ b/src/tests/Feature/Controller/SignupTest.php
@@ -1236,6 +1236,8 @@
['administrator', $domain, false, ['login' => 'The specified login is not available.']],
['sales', $domain, false, ['login' => 'The specified login is not available.']],
['root', $domain, false, ['login' => 'The specified login is not available.']],
+ ['anonymous', $domain, false, ['login' => 'The specified login is not available.']],
+ ['anonymous', 'kolabsys.com', false, ['login' => 'The specified login is not available.']],
// Domain account
['admin', 'kolabsys.com', true, null],
diff --git a/src/tests/Feature/Controller/UsersTest.php b/src/tests/Feature/Controller/UsersTest.php
--- a/src/tests/Feature/Controller/UsersTest.php
+++ b/src/tests/Feature/Controller/UsersTest.php
@@ -1638,6 +1638,10 @@
["{$domain}", $john, 'The specified email is invalid.'],
[".@{$domain}", $john, 'The specified email is invalid.'],
+ // blacklisted
+ ["anonymous@kolab.org", $john, 'The specified email is not available.'],
+ ["anyone@kolab.org", $john, 'The specified email is not available.'],
+
// forbidden local part on public domains
["admin@{$domain}", $john, 'The specified email is not available.'],
["administrator@{$domain}", $john, 'The specified email is not available.'],
diff --git a/src/tests/Unit/Rules/UserEmailLocalTest.php b/src/tests/Unit/Rules/UserEmailLocalTest.php
--- a/src/tests/Unit/Rules/UserEmailLocalTest.php
+++ b/src/tests/Unit/Rules/UserEmailLocalTest.php
@@ -48,6 +48,11 @@
['Root', false, 'The specified user is not available.'],
['Postmaster', false, 'The specified user is not available.'],
['Webmaster', false, 'The specified user is not available.'],
+ ['anonymous', false, 'The specified user is not available.'],
+ ['AnoNymous', false, 'The specified user is not available.'],
+ ['anonymous', true, 'The specified user is not available.'],
+ ['anyone', false, 'The specified user is not available.'],
+ ['anyOne', true, 'The specified user is not available.'],
// Valid
['test.test', false, null],
// Valid for external domains
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Apr 3, 11:12 AM (14 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18823787
Default Alt Text
D5637.1775214747.diff (3 KB)
Attached To
Mode
D5637: Disallow anonymous@ and anyone@
Attached
Detach File
Event Timeline