Page MenuHomePhorge

D3890.1775457129.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D3890.1775457129.diff

diff --git a/src/app/Jobs/User/CreateJob.php b/src/app/Jobs/User/CreateJob.php
--- a/src/app/Jobs/User/CreateJob.php
+++ b/src/app/Jobs/User/CreateJob.php
@@ -67,6 +67,24 @@
return;
}
+ if (!$user->isActive() && ($script = \config('services.abuse-check'))) {
+ exec($script . ' ' . $this->userId, $output, $retval);
+
+ // We expect error code 0, so an error in the script does not cause user suspension
+ // FIXME: Should an error stop the process of user creation or not?
+ if ($retval > 0) {
+ throw new \Exception("Abuse check failed for user {$this->userId}.");
+ }
+
+ // The script should output "ABUSE" if the user is a suspected spammer
+ if (strpos(implode('', $output), 'ABUSE') !== false) {
+ $user->status |= \App\User::STATUS_SUSPENDED;
+ }
+ }
+
+ $user->status |= \App\User::STATUS_ACTIVE;
+ $user->save();
+
if ($withLdap && !$user->isLdapReady()) {
\App\Backends\LDAP::createUser($user);
@@ -80,9 +98,7 @@
}
$user->status |= \App\User::STATUS_IMAP_READY;
+ $user->save();
}
-
- $user->status |= \App\User::STATUS_ACTIVE;
- $user->save();
}
}
diff --git a/src/config/services.php b/src/config/services.php
--- a/src/config/services.php
+++ b/src/config/services.php
@@ -14,6 +14,8 @@
|
*/
+ 'abuse-check' => env('ABUSE_CHECK', null),
+
'mailgun' => [
'domain' => env('MAILGUN_DOMAIN'),
'secret' => env('MAILGUN_SECRET'),

File Metadata

Mime Type
text/plain
Expires
Mon, Apr 6, 6:32 AM (14 h, 1 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18834790
Default Alt Text
D3890.1775457129.diff (1 KB)

Event Timeline