Jelajahi Sumber

Added Laravel Pint for formatting

Will Browning 2 tahun lalu
induk
melakukan
fd92e09e5e
100 mengubah file dengan 398 tambahan dan 345 penghapusan
  1. 0 21
      .php-cs-fixer.php
  2. 1 1
      README.md
  3. 1 1
      app/Console/Commands/CheckDomainsMxValidation.php
  4. 20 19
      app/Console/Commands/CreateUser.php
  5. 1 1
      app/Console/Commands/ListUsers.php
  6. 27 22
      app/Console/Commands/ReceiveEmail.php
  7. 1 1
      app/Console/Kernel.php
  8. 1 1
      app/CustomMailDriver/CustomMailManager.php
  9. 5 5
      app/CustomMailDriver/CustomMailer.php
  10. 29 35
      app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php
  11. 1 1
      app/CustomMailDriver/Mime/Encoder/RawContentEncoder.php
  12. 6 2
      app/CustomMailDriver/Mime/Part/EncryptedPart.php
  13. 1 0
      app/CustomMailDriver/Validation/MessageIDValidation.php
  14. 2 2
      app/Exports/AliasesExport.php
  15. 1 1
      app/Http/Controllers/Api/AccountDetailController.php
  16. 6 7
      app/Http/Controllers/Api/AliasController.php
  17. 1 1
      app/Http/Controllers/Api/ApiTokenDetailController.php
  18. 1 1
      app/Http/Controllers/Api/DomainController.php
  19. 1 1
      app/Http/Controllers/Api/DomainOptionController.php
  20. 2 2
      app/Http/Controllers/Api/FailedDeliveryController.php
  21. 3 3
      app/Http/Controllers/Api/RecipientKeyController.php
  22. 1 1
      app/Http/Controllers/Api/ReorderRuleController.php
  23. 2 2
      app/Http/Controllers/Api/RuleController.php
  24. 9 9
      app/Http/Controllers/Auth/ApiAuthenticationController.php
  25. 3 3
      app/Http/Controllers/Auth/BackupCodeController.php
  26. 2 2
      app/Http/Controllers/Auth/PersonalAccessTokenController.php
  27. 5 5
      app/Http/Controllers/Auth/RegisterController.php
  28. 5 4
      app/Http/Controllers/Auth/TwoFactorAuthController.php
  29. 1 0
      app/Http/Controllers/Auth/VerificationController.php
  30. 6 6
      app/Http/Controllers/Auth/WebauthnController.php
  31. 1 1
      app/Http/Controllers/DeactivateAliasController.php
  32. 1 1
      app/Http/Controllers/DomainVerificationController.php
  33. 1 1
      app/Http/Controllers/PasswordController.php
  34. 2 2
      app/Http/Controllers/SettingController.php
  35. 4 4
      app/Http/Controllers/ShowAliasController.php
  36. 1 1
      app/Http/Controllers/ShowDomainController.php
  37. 3 3
      app/Http/Controllers/ShowFailedDeliveryController.php
  38. 2 2
      app/Http/Controllers/ShowRecipientController.php
  39. 1 1
      app/Http/Controllers/ShowRuleController.php
  40. 1 1
      app/Http/Controllers/ShowUsernameController.php
  41. 1 1
      app/Http/Middleware/VerifyCsrfToken.php
  42. 1 1
      app/Http/Middleware/VerifyTwoFactorAuth.php
  43. 2 2
      app/Http/Middleware/VerifyWebauthn.php
  44. 1 1
      app/Http/Requests/ApiAuthenticationLoginRequest.php
  45. 1 1
      app/Http/Requests/ApiAuthenticationMfaRequest.php
  46. 1 1
      app/Http/Requests/DestroyAccountRequest.php
  47. 1 1
      app/Http/Requests/DisableTwoFactorAuthRequest.php
  48. 3 3
      app/Http/Requests/EditDefaultRecipientRequest.php
  49. 1 1
      app/Http/Requests/EnableTwoFactorAuthRequest.php
  50. 7 7
      app/Http/Requests/IndexAliasRequest.php
  51. 1 1
      app/Http/Requests/IndexRecipientRequest.php
  52. 2 2
      app/Http/Requests/StoreAliasRecipientRequest.php
  53. 5 4
      app/Http/Requests/StoreAliasRequest.php
  54. 2 2
      app/Http/Requests/StoreDomainRequest.php
  55. 3 3
      app/Http/Requests/StorePersonalAccessTokenRequest.php
  56. 2 2
      app/Http/Requests/StoreRecipientRequest.php
  57. 2 2
      app/Http/Requests/StoreReorderRuleRequest.php
  58. 12 12
      app/Http/Requests/StoreRuleRequest.php
  59. 1 1
      app/Http/Requests/StoreUsernameRequest.php
  60. 1 1
      app/Http/Requests/UpdateAliasRequest.php
  61. 1 1
      app/Http/Requests/UpdateBannerLocationRequest.php
  62. 2 2
      app/Http/Requests/UpdateDefaultAliasDomainRequest.php
  63. 2 2
      app/Http/Requests/UpdateDefaultAliasFormatRequest.php
  64. 1 1
      app/Http/Requests/UpdateDefaultRecipientRequest.php
  65. 1 1
      app/Http/Requests/UpdateDomainDefaultRecipientRequest.php
  66. 1 1
      app/Http/Requests/UpdateDomainRequest.php
  67. 1 1
      app/Http/Requests/UpdateEmailSubjectRequest.php
  68. 1 1
      app/Http/Requests/UpdateFromNameRequest.php
  69. 1 1
      app/Http/Requests/UpdatePasswordRequest.php
  70. 2 2
      app/Http/Requests/UpdateRecipientKeyRequest.php
  71. 1 1
      app/Http/Requests/UpdateUseReplyToRequest.php
  72. 1 1
      app/Http/Requests/UpdateUsernameDefaultRecipientRequest.php
  73. 1 1
      app/Http/Requests/UpdateUsernameRequest.php
  74. 4 4
      app/Http/Resources/UserResource.php
  75. 1 1
      app/Listeners/SendIncorrectOtpNotification.php
  76. 40 11
      app/Mail/ForwardEmail.php
  77. 22 8
      app/Mail/ReplyToEmail.php
  78. 20 8
      app/Mail/SendFromEmail.php
  79. 3 2
      app/Mail/TokenExpiringSoon.php
  80. 4 4
      app/Models/Alias.php
  81. 1 1
      app/Models/AliasRecipient.php
  82. 2 2
      app/Models/DeletedUsername.php
  83. 19 19
      app/Models/Domain.php
  84. 4 4
      app/Models/EmailData.php
  85. 4 4
      app/Models/FailedDelivery.php
  86. 1 1
      app/Models/PostfixQueueId.php
  87. 4 5
      app/Models/Recipient.php
  88. 3 3
      app/Models/Rule.php
  89. 7 6
      app/Models/User.php
  90. 4 3
      app/Models/Username.php
  91. 1 1
      app/Notifications/CustomVerifyEmail.php
  92. 2 2
      app/Notifications/DefaultRecipientUpdated.php
  93. 5 2
      app/Notifications/DisallowedReplySendAttempt.php
  94. 1 1
      app/Notifications/DomainMxRecordsInvalid.php
  95. 3 2
      app/Notifications/DomainUnverifiedForSending.php
  96. 4 2
      app/Notifications/FailedDeliveryNotification.php
  97. 2 2
      app/Notifications/GpgKeyExpired.php
  98. 2 2
      app/Notifications/IncorrectOtpNotification.php
  99. 2 1
      app/Notifications/NearBandwidthLimit.php
  100. 5 2
      app/Notifications/SpamReplySendAttempt.php

+ 0 - 21
.php-cs-fixer.php

@@ -1,21 +0,0 @@
-<?php
-
-$finder = Symfony\Component\Finder\Finder::create()
-    ->notPath('vendor')
-    ->notPath('bootstrap')
-    ->notPath('storage')
-    ->in(__DIR__)
-    ->name('*.php')
-    ->notName('*.blade.php')
-    ->ignoreDotFiles(true)
-    ->ignoreVCS(true);
-
-$config = new PhpCsFixer\Config();
-
-return $config->setRules([
-        '@PSR12' => true,
-        'array_syntax' => ['syntax' => 'short'],
-        'ordered_imports' => ['sort_algorithm' => 'alpha'],
-        'no_unused_imports' => true,
-    ])
-    ->setFinder($finder);

+ 1 - 1
README.md

@@ -464,7 +464,7 @@ For full details please see the [self-hosting instructions file](SELF-HOSTING.md
 
 
 ## My sponsors
 ## My sponsors
 
 
-Thanks to [Vlad Timofeev](https://github.com/vlad-timofeev), [Patrick Dobler](https://github.com/patrickdobler), [Luca Steeb](https://github.com/steebchen), [Laiteux](https://github.com/Laiteux) and [narolinus](https://github.com/narolinus) for supporting me by sponsoring the project on GitHub!
+Thanks to [Vlad Timofeev](https://github.com/vlad-timofeev), [Patrick Dobler](https://github.com/patrickdobler), [Luca Steeb](https://github.com/steebchen), [Laiteux](https://github.com/Laiteux), [narolinus](https://github.com/narolinus) and [Limon Monte](https://github.com/limonte) for supporting me by sponsoring the project on GitHub!
 
 
 Also an extra special thanks to [CrazyMax](https://github.com/crazy-max) for sponsoring me and also creating and maintaining the awesome [AnonAddy Docker image](https://github.com/anonaddy/docker)!
 Also an extra special thanks to [CrazyMax](https://github.com/crazy-max) for sponsoring me and also creating and maintaining the awesome [AnonAddy Docker image](https://github.com/anonaddy/docker)!
 
 

+ 1 - 1
app/Console/Commands/CheckDomainsMxValidation.php

@@ -44,7 +44,7 @@ class CheckDomainsMxValidation extends Command
             try {
             try {
                 if (! $domain->checkMxRecords()) {
                 if (! $domain->checkMxRecords()) {
                     // Notify user via email only if domain's MX previously were valid
                     // Notify user via email only if domain's MX previously were valid
-                    if (!is_null($domain->domain_mx_validated_at)) {
+                    if (! is_null($domain->domain_mx_validated_at)) {
                         $domain->user->notify(new DomainMxRecordsInvalid($domain->domain));
                         $domain->user->notify(new DomainMxRecordsInvalid($domain->domain));
                     }
                     }
 
 

+ 20 - 19
app/Console/Commands/CreateUser.php

@@ -49,40 +49,41 @@ class CreateUser extends Command
     {
     {
         $validator = Validator::make([
         $validator = Validator::make([
             'username' => $this->argument('username'),
             'username' => $this->argument('username'),
-            'email' => $this->argument('email')], [
-            'username' => [
-                'required',
-                'regex:/^[a-zA-Z0-9]*$/',
-                'max:20',
-                'unique:usernames,username',
-                new NotDeletedUsername()
-            ],
-            'email' => [
-                'required',
-                'email:rfc,dns',
-                'max:254',
-                new RegisterUniqueRecipient(),
-                new NotLocalRecipient()
-            ],
-        ]);
+            'email' => $this->argument('email'), ], [
+                'username' => [
+                    'required',
+                    'regex:/^[a-zA-Z0-9]*$/',
+                    'max:20',
+                    'unique:usernames,username',
+                    new NotDeletedUsername(),
+                ],
+                'email' => [
+                    'required',
+                    'email:rfc,dns',
+                    'max:254',
+                    new RegisterUniqueRecipient(),
+                    new NotLocalRecipient(),
+                ],
+            ]);
 
 
         if ($validator->fails()) {
         if ($validator->fails()) {
             $errors = $validator->errors();
             $errors = $validator->errors();
             foreach ($errors->all() as $message) {
             foreach ($errors->all() as $message) {
                 $this->error($message);
                 $this->error($message);
             }
             }
+
             return 1;
             return 1;
         }
         }
         $userId = Uuid::uuid4();
         $userId = Uuid::uuid4();
 
 
         $recipient = Recipient::create([
         $recipient = Recipient::create([
             'email' => $this->argument('email'),
             'email' => $this->argument('email'),
-            'user_id' => $userId
+            'user_id' => $userId,
         ]);
         ]);
 
 
         $username = Username::create([
         $username = Username::create([
             'username' => $this->argument('username'),
             'username' => $this->argument('username'),
-            'user_id' => $userId
+            'user_id' => $userId,
         ]);
         ]);
 
 
         $twoFactor = app('pragmarx.google2fa');
         $twoFactor = app('pragmarx.google2fa');
@@ -92,7 +93,7 @@ class CreateUser extends Command
             'default_username_id' => $username->id,
             'default_username_id' => $username->id,
             'default_recipient_id' => $recipient->id,
             'default_recipient_id' => $recipient->id,
             'password' => Hash::make($userId),
             'password' => Hash::make($userId),
-            'two_factor_secret' => $twoFactor->generateSecretKey()
+            'two_factor_secret' => $twoFactor->generateSecretKey(),
         ]);
         ]);
 
 
         event(new Registered($user));
         event(new Registered($user));

+ 1 - 1
app/Console/Commands/ListUsers.php

@@ -81,7 +81,7 @@ class ListUsers extends Command
                 'username' => $user->defaultUsername->username,
                 'username' => $user->defaultUsername->username,
                 'bandwidth' => $user->bandwidth,
                 'bandwidth' => $user->bandwidth,
                 'created_at' => $user->created_at,
                 'created_at' => $user->created_at,
-                'updated_at' => $user->updated_at
+                'updated_at' => $user->updated_at,
             ];
             ];
         });
         });
 
 

+ 27 - 22
app/Console/Commands/ReceiveEmail.php

@@ -44,8 +44,11 @@ class ReceiveEmail extends Command
      * @var string
      * @var string
      */
      */
     protected $description = 'Receive email from postfix pipe';
     protected $description = 'Receive email from postfix pipe';
+
     protected $parser;
     protected $parser;
+
     protected $senderFrom;
     protected $senderFrom;
+
     protected $size;
     protected $size;
 
 
     /**
     /**
@@ -87,7 +90,7 @@ class ReceiveEmail extends Command
                 }
                 }
 
 
                 // First determine if the alias already exists in the database
                 // First determine if the alias already exists in the database
-                if ($alias = Alias::firstWhere('email', $recipient['local_part'] . '@' . $recipient['domain'])) {
+                if ($alias = Alias::firstWhere('email', $recipient['local_part'].'@'.$recipient['domain'])) {
                     $user = $alias->user;
                     $user = $alias->user;
 
 
                     if ($alias->aliasable_id) {
                     if ($alias->aliasable_id) {
@@ -101,17 +104,18 @@ class ReceiveEmail extends Command
                     })
                     })
                     ->first();
                     ->first();
 
 
-                    if (!empty($parentDomain)) {
+                    if (! empty($parentDomain)) {
                         // It is standard or username alias
                         // It is standard or username alias
-                        $subdomain = substr($recipient['domain'], 0, strrpos($recipient['domain'], '.' . $parentDomain)); // e.g. johndoe
+                        $subdomain = substr($recipient['domain'], 0, strrpos($recipient['domain'], '.'.$parentDomain)); // e.g. johndoe
 
 
                         if ($subdomain === 'unsubscribe') {
                         if ($subdomain === 'unsubscribe') {
                             $this->handleUnsubscribe($recipient);
                             $this->handleUnsubscribe($recipient);
+
                             continue;
                             continue;
                         }
                         }
 
 
                         // Check if this is an username or standard alias
                         // Check if this is an username or standard alias
-                        if (!empty($subdomain)) {
+                        if (! empty($subdomain)) {
                             $username = Username::where('username', $subdomain)->first();
                             $username = Username::where('username', $subdomain)->first();
                             $user = $username->user;
                             $user = $username->user;
                             $aliasable = $username;
                             $aliasable = $username;
@@ -124,13 +128,13 @@ class ReceiveEmail extends Command
                         }
                         }
                     }
                     }
 
 
-                    if (!isset($user) && !empty(config('anonaddy.admin_username'))) {
+                    if (! isset($user) && ! empty(config('anonaddy.admin_username'))) {
                         $user = Username::where('username', config('anonaddy.admin_username'))->first()?->user;
                         $user = Username::where('username', config('anonaddy.admin_username'))->first()?->user;
                     }
                     }
                 }
                 }
 
 
                 // If there is still no user or the user has no verified default recipient then continue.
                 // If there is still no user or the user has no verified default recipient then continue.
-                if (!isset($user) || !$user->hasVerifiedDefaultRecipient()) {
+                if (! isset($user) || ! $user->hasVerifiedDefaultRecipient()) {
                     continue;
                     continue;
                 }
                 }
 
 
@@ -203,11 +207,11 @@ class ReceiveEmail extends Command
     {
     {
         if (is_null($alias)) {
         if (is_null($alias)) {
             $alias = $user->aliases()->create([
             $alias = $user->aliases()->create([
-                'email' => $recipient['local_part'] . '@' . $recipient['domain'],
+                'email' => $recipient['local_part'].'@'.$recipient['domain'],
                 'local_part' => $recipient['local_part'],
                 'local_part' => $recipient['local_part'],
                 'domain' => $recipient['domain'],
                 'domain' => $recipient['domain'],
                 'aliasable_id' => $aliasable?->id,
                 'aliasable_id' => $aliasable?->id,
-                'aliasable_type' => $aliasable ? 'App\\Models\\' . class_basename($aliasable) : null
+                'aliasable_type' => $aliasable ? 'App\\Models\\'.class_basename($aliasable) : null,
             ]);
             ]);
 
 
             // Hydrate all alias fields
             // Hydrate all alias fields
@@ -228,11 +232,11 @@ class ReceiveEmail extends Command
         if (is_null($alias)) {
         if (is_null($alias)) {
             // This is a new alias
             // This is a new alias
             $alias = new Alias([
             $alias = new Alias([
-                'email' => $recipient['local_part'] . '@' . $recipient['domain'],
+                'email' => $recipient['local_part'].'@'.$recipient['domain'],
                 'local_part' => $recipient['local_part'],
                 'local_part' => $recipient['local_part'],
                 'domain' => $recipient['domain'],
                 'domain' => $recipient['domain'],
                 'aliasable_id' => $aliasable?->id,
                 'aliasable_id' => $aliasable?->id,
-                'aliasable_type' => $aliasable ? 'App\\Models\\' . class_basename($aliasable) : null
+                'aliasable_type' => $aliasable ? 'App\\Models\\'.class_basename($aliasable) : null,
             ]);
             ]);
 
 
             if ($user->hasExceededNewAliasLimit()) {
             if ($user->hasExceededNewAliasLimit()) {
@@ -248,11 +252,11 @@ class ReceiveEmail extends Command
 
 
                 $recipientIds = $user
                 $recipientIds = $user
                     ->recipients()
                     ->recipients()
-                    ->select(['id','email_verified_at'])
+                    ->select(['id', 'email_verified_at'])
                     ->oldest()
                     ->oldest()
                     ->get()
                     ->get()
                     ->filter(function ($item, $key) use ($keys) {
                     ->filter(function ($item, $key) use ($keys) {
-                        return in_array($key + 1, $keys) && !is_null($item['email_verified_at']);
+                        return in_array($key + 1, $keys) && ! is_null($item['email_verified_at']);
                     })
                     })
                     ->pluck('id')
                     ->pluck('id')
                     ->take(10)
                     ->take(10)
@@ -296,7 +300,7 @@ class ReceiveEmail extends Command
                 // First check in DB
                 // First check in DB
                 $postfixQueueId = PostfixQueueId::firstWhere('queue_id', strtoupper($dsn['X-postfix-queue-id']));
                 $postfixQueueId = PostfixQueueId::firstWhere('queue_id', strtoupper($dsn['X-postfix-queue-id']));
 
 
-                if (!$postfixQueueId) {
+                if (! $postfixQueueId) {
                     exit(0);
                     exit(0);
                 }
                 }
 
 
@@ -332,7 +336,7 @@ class ReceiveEmail extends Command
 
 
             // Try to find a user from the bounced email address
             // Try to find a user from the bounced email address
             if ($recipient = Recipient::select(['id', 'user_id', 'email', 'email_verified_at'])->get()->firstWhere('email', $bouncedEmailAddress)) {
             if ($recipient = Recipient::select(['id', 'user_id', 'email', 'email_verified_at'])->get()->firstWhere('email', $bouncedEmailAddress)) {
-                if (!isset($user)) {
+                if (! isset($user)) {
                     $user = $recipient->user;
                     $user = $recipient->user;
                 }
                 }
             }
             }
@@ -350,11 +354,11 @@ class ReceiveEmail extends Command
                 if (isset($undeliveredMessageHeaders['Feedback-id'])) {
                 if (isset($undeliveredMessageHeaders['Feedback-id'])) {
                     $parts = explode(':', $undeliveredMessageHeaders['Feedback-id']);
                     $parts = explode(':', $undeliveredMessageHeaders['Feedback-id']);
 
 
-                    if (in_array($parts[0], ['F', 'R', 'S']) && !isset($alias)) {
+                    if (in_array($parts[0], ['F', 'R', 'S']) && ! isset($alias)) {
                         $alias = Alias::find($parts[1]);
                         $alias = Alias::find($parts[1]);
 
 
                         // Find the user from the alias if we don't have it from the recipient
                         // Find the user from the alias if we don't have it from the recipient
-                        if (!isset($user) && isset($alias)) {
+                        if (! isset($user) && isset($alias)) {
                             $user = $alias->user;
                             $user = $alias->user;
                         }
                         }
                     }
                     }
@@ -385,7 +389,7 @@ class ReceiveEmail extends Command
                     'email_type' => $parts[0] ?? null,
                     'email_type' => $parts[0] ?? null,
                     'status' => $dsn['Status'] ?? null,
                     'status' => $dsn['Status'] ?? null,
                     'code' => $diagnosticCode,
                     'code' => $diagnosticCode,
-                    'attempted_at' => $postfixQueueId->created_at
+                    'attempted_at' => $postfixQueueId->created_at,
                 ]);
                 ]);
 
 
                 if (isset($alias)) {
                 if (isset($alias)) {
@@ -452,7 +456,7 @@ class ReceiveEmail extends Command
                 'email' => $item,
                 'email' => $item,
                 'local_part' => strtolower($this->option('local_part')[$key]),
                 'local_part' => strtolower($this->option('local_part')[$key]),
                 'extension' => $this->option('extension')[$key],
                 'extension' => $this->option('extension')[$key],
-                'domain' => strtolower($this->option('domain')[$key])
+                'domain' => strtolower($this->option('domain')[$key]),
             ];
             ];
         });
         });
     }
     }
@@ -472,7 +476,7 @@ class ReceiveEmail extends Command
                 try {
                 try {
                     mailparse_rfc822_parse_addresses($value);
                     mailparse_rfc822_parse_addresses($value);
                 } catch (\Exception $e) {
                 } catch (\Exception $e) {
-                    $part['headers']['from'] = str_replace("\\", "", $part['headers']['from']);
+                    $part['headers']['from'] = str_replace('\\', '', $part['headers']['from']);
                     $mimePart->setPart($part);
                     $mimePart->setPart($part);
                 }
                 }
             }
             }
@@ -483,7 +487,7 @@ class ReceiveEmail extends Command
         if ($file == 'stream') {
         if ($file == 'stream') {
             $fd = fopen('php://stdin', 'r');
             $fd = fopen('php://stdin', 'r');
             $this->rawEmail = '';
             $this->rawEmail = '';
-            while (!feof($fd)) {
+            while (! feof($fd)) {
                 $this->rawEmail .= fread($fd, 1024);
                 $this->rawEmail .= fread($fd, 1024);
             }
             }
             fclose($fd);
             fclose($fd);
@@ -491,6 +495,7 @@ class ReceiveEmail extends Command
         } else {
         } else {
             $parser->setPath($file);
             $parser->setPath($file);
         }
         }
+
         return $parser;
         return $parser;
     }
     }
 
 
@@ -508,7 +513,7 @@ class ReceiveEmail extends Command
                     $result[$key] = trim($matches[2]);
                     $result[$key] = trim($matches[2]);
                 }
                 }
             } elseif (preg_match('/^\s+(.+)\s*/', $line) && isset($key)) {
             } elseif (preg_match('/^\s+(.+)\s*/', $line) && isset($key)) {
-                $result[$key] .= ' ' . $line;
+                $result[$key] .= ' '.$line;
             }
             }
         }
         }
 
 
@@ -521,7 +526,7 @@ class ReceiveEmail extends Command
             return 'hard';
             return 'hard';
         }
         }
 
 
-        if (preg_match("/(:?spam|unsolicited|blacklisting|blacklisted|blacklist|554|mail content denied|reject for policy reason|mail rejected by destination domain|security issue)/i", $code)) {
+        if (preg_match('/(:?spam|unsolicited|blacklisting|blacklisted|blacklist|554|mail content denied|reject for policy reason|mail rejected by destination domain|security issue)/i', $code)) {
             return 'spam';
             return 'spam';
         }
         }
 
 

+ 1 - 1
app/Console/Kernel.php

@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
      * @var array
      * @var array
      */
      */
     protected $commands = [
     protected $commands = [
-        'App\Console\Commands\ResetBandwidth'
+        'App\Console\Commands\ResetBandwidth',
     ];
     ];
 
 
     /**
     /**

+ 1 - 1
app/CustomMailDriver/CustomMailManager.php

@@ -10,7 +10,7 @@ class CustomMailManager extends MailManager
     /**
     /**
      * Resolve the given mailer.
      * Resolve the given mailer.
      *
      *
-     * @param string $name
+     * @param  string  $name
      * @return Mailer
      * @return Mailer
      */
      */
     protected function resolve($name): CustomMailer
     protected function resolve($name): CustomMailer

+ 5 - 5
app/CustomMailDriver/CustomMailer.php

@@ -23,7 +23,7 @@ class CustomMailer extends Mailer
     /**
     /**
      * Send a new message using a view.
      * Send a new message using a view.
      *
      *
-     * @param MailableContract|string|array  $view
+     * @param  MailableContract|string|array  $view
      * @param  array  $data
      * @param  array  $data
      * @param  \Closure|string|null  $callback
      * @param  \Closure|string|null  $callback
      * @return SentMessage|null
      * @return SentMessage|null
@@ -67,7 +67,7 @@ class CustomMailer extends Mailer
             $recipient = Recipient::find($data['recipientId']);
             $recipient = Recipient::find($data['recipientId']);
 
 
             try {
             try {
-                $encrypter = new OpenPGPEncrypter(config('anonaddy.signing_key_fingerprint'), $data['fingerprint'], "~/.gnupg", $recipient->protected_headers);
+                $encrypter = new OpenPGPEncrypter(config('anonaddy.signing_key_fingerprint'), $data['fingerprint'], '~/.gnupg', $recipient->protected_headers);
             } catch (RuntimeException $e) {
             } catch (RuntimeException $e) {
                 info($e->getMessage());
                 info($e->getMessage());
                 $encrypter = null;
                 $encrypter = null;
@@ -114,7 +114,7 @@ class CustomMailer extends Mailer
                 'Subject',
                 'Subject',
                 'Date',
                 'Date',
                 'Original-Sender',
                 'Original-Sender',
-                'Sender'
+                'Sender',
             ])->toArray();
             ])->toArray();
             $signedEmail = $dkimSigner->sign($symfonyMessage, $options);
             $signedEmail = $dkimSigner->sign($symfonyMessage, $options);
             $symfonyMessage->setHeaders($signedEmail->getHeaders());
             $symfonyMessage->setHeaders($signedEmail->getHeaders());
@@ -130,10 +130,10 @@ class CustomMailer extends Mailer
 
 
                 try {
                 try {
                     // Get Postfix Queue ID and save in DB
                     // Get Postfix Queue ID and save in DB
-                    $id = str_replace("\r\n", "", Str::after($sentMessage->getDebug(), 'Ok: queued as '));
+                    $id = str_replace("\r\n", '', Str::after($sentMessage->getDebug(), 'Ok: queued as '));
 
 
                     PostfixQueueId::create([
                     PostfixQueueId::create([
-                        'queue_id' => $id
+                        'queue_id' => $id,
                     ]);
                     ]);
                 } catch (QueryException $e) {
                 } catch (QueryException $e) {
                     // duplicate entry
                     // duplicate entry

+ 29 - 35
app/CustomMailDriver/Mime/Crypto/OpenPGPEncrypter.php

@@ -10,6 +10,7 @@ use Symfony\Component\Mime\Email;
 class OpenPGPEncrypter
 class OpenPGPEncrypter
 {
 {
     protected $gnupg = null;
     protected $gnupg = null;
+
     protected $usesProtectedHeaders;
     protected $usesProtectedHeaders;
 
 
     /**
     /**
@@ -53,18 +54,17 @@ class OpenPGPEncrypter
      */
      */
     protected $gnupgHome = null;
     protected $gnupgHome = null;
 
 
-
     public function __construct($signingKey = null, $recipientKey = null, $gnupgHome = null, $usesProtectedHeaders = false)
     public function __construct($signingKey = null, $recipientKey = null, $gnupgHome = null, $usesProtectedHeaders = false)
     {
     {
         $this->initGNUPG();
         $this->initGNUPG();
-        $this->signingKey    = $signingKey;
+        $this->signingKey = $signingKey;
         $this->recipientKey = $recipientKey;
         $this->recipientKey = $recipientKey;
-        $this->gnupgHome     = $gnupgHome;
+        $this->gnupgHome = $gnupgHome;
         $this->usesProtectedHeaders = $usesProtectedHeaders;
         $this->usesProtectedHeaders = $usesProtectedHeaders;
     }
     }
 
 
     /**
     /**
-     * @param string $micalg
+     * @param  string  $micalg
      */
      */
     public function setMicalg($micalg)
     public function setMicalg($micalg)
     {
     {
@@ -73,14 +73,14 @@ class OpenPGPEncrypter
 
 
     /**
     /**
      * @param $identifier
      * @param $identifier
-     * @param null $passPhrase
+     * @param  null  $passPhrase
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
      */
      */
     public function addSignature($identifier, $keyFingerprint = null, $passPhrase = null)
     public function addSignature($identifier, $keyFingerprint = null, $passPhrase = null)
     {
     {
-        if (!$keyFingerprint) {
-            $keyFingerprint   = $this->getKey($identifier, 'sign');
+        if (! $keyFingerprint) {
+            $keyFingerprint = $this->getKey($identifier, 'sign');
         }
         }
         $this->signingKey = $keyFingerprint;
         $this->signingKey = $keyFingerprint;
 
 
@@ -97,13 +97,12 @@ class OpenPGPEncrypter
      */
      */
     public function addKeyPassphrase($identifier, $passPhrase)
     public function addKeyPassphrase($identifier, $passPhrase)
     {
     {
-        $keyFingerprint                        = $this->getKey($identifier, 'sign');
+        $keyFingerprint = $this->getKey($identifier, 'sign');
         $this->keyPassphrases[$keyFingerprint] = $passPhrase;
         $this->keyPassphrases[$keyFingerprint] = $passPhrase;
     }
     }
 
 
     /**
     /**
-     * @param Email $email
-     *
+     * @param  Email  $email
      * @return $this
      * @return $this
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
@@ -117,19 +116,19 @@ class OpenPGPEncrypter
         $boundary = strtr(base64_encode(random_bytes(6)), '+/', '-_');
         $boundary = strtr(base64_encode(random_bytes(6)), '+/', '-_');
 
 
         $headers->setHeaderBody('Parameterized', 'Content-Type', 'multipart/signed');
         $headers->setHeaderBody('Parameterized', 'Content-Type', 'multipart/signed');
-        $headers->setHeaderParameter('Content-Type', 'micalg', sprintf("pgp-%s", strtolower($this->micalg)));
+        $headers->setHeaderParameter('Content-Type', 'micalg', sprintf('pgp-%s', strtolower($this->micalg)));
         $headers->setHeaderParameter('Content-Type', 'protocol', 'application/pgp-signature');
         $headers->setHeaderParameter('Content-Type', 'protocol', 'application/pgp-signature');
         $headers->setHeaderParameter('Content-Type', 'boundary', $boundary);
         $headers->setHeaderParameter('Content-Type', 'boundary', $boundary);
 
 
         $message->setHeaders($headers);
         $message->setHeaders($headers);
 
 
-        if (!$this->signingKey) {
+        if (! $this->signingKey) {
             foreach ($message->getFrom() as $key => $value) {
             foreach ($message->getFrom() as $key => $value) {
                 $this->addSignature($this->getKey($key, 'sign'));
                 $this->addSignature($this->getKey($key, 'sign'));
             }
             }
         }
         }
 
 
-        if (!$this->signingKey) {
+        if (! $this->signingKey) {
             throw new RuntimeException('Signing has been enabled, but no signature has been added. Use autoAddSignature() or addSignature()');
             throw new RuntimeException('Signing has been enabled, but no signature has been added. Use autoAddSignature() or addSignature()');
         }
         }
 
 
@@ -143,7 +142,7 @@ class OpenPGPEncrypter
         // Check if using protected headers or not
         // Check if using protected headers or not
         if ($this->usesProtectedHeaders) {
         if ($this->usesProtectedHeaders) {
             $protectedHeadersSet = false;
             $protectedHeadersSet = false;
-            for ($i=0; $i<count($lines); $i++) {
+            for ($i = 0; $i < count($lines); $i++) {
                 if (Str::startsWith(strtolower($lines[$i]), 'content-type: text/plain') || Str::startsWith(strtolower($lines[$i]), 'content-type: multipart/')) {
                 if (Str::startsWith(strtolower($lines[$i]), 'content-type: text/plain') || Str::startsWith(strtolower($lines[$i]), 'content-type: multipart/')) {
                     $lines[$i] = rtrim($lines[$i])."; protected-headers=\"v1\"\r\n";
                     $lines[$i] = rtrim($lines[$i])."; protected-headers=\"v1\"\r\n";
                     if (! $protectedHeadersSet) {
                     if (! $protectedHeadersSet) {
@@ -155,7 +154,7 @@ class OpenPGPEncrypter
                 }
                 }
             }
             }
         } else {
         } else {
-            for ($i=0; $i<count($lines); $i++) {
+            for ($i = 0; $i < count($lines); $i++) {
                 $lines[$i] = rtrim($lines[$i])."\r\n";
                 $lines[$i] = rtrim($lines[$i])."\r\n";
             }
             }
         }
         }
@@ -178,7 +177,7 @@ class OpenPGPEncrypter
 
 
         $signed = sprintf("%s\r\n%s", $message->getHeaders()->get('content-type')->toString(), $body);
         $signed = sprintf("%s\r\n%s", $message->getHeaders()->get('content-type')->toString(), $body);
 
 
-        if (!$this->recipientKey) {
+        if (! $this->recipientKey) {
             throw new RuntimeException('Encryption has been enabled, but no recipients have been added. Use autoAddRecipients() or addRecipient()');
             throw new RuntimeException('Encryption has been enabled, but no recipients have been added. Use autoAddRecipients() or addRecipient()');
         }
         }
 
 
@@ -207,25 +206,24 @@ class OpenPGPEncrypter
     }
     }
 
 
     /**
     /**
-     * @param Email $email
-     *
+     * @param  Email  $email
      * @return $this
      * @return $this
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
      */
      */
     public function encryptInline(Email $message): Email
     public function encryptInline(Email $message): Email
     {
     {
-        if (!$this->signingKey) {
+        if (! $this->signingKey) {
             foreach ($message->getFrom() as $key => $value) {
             foreach ($message->getFrom() as $key => $value) {
                 $this->addSignature($this->getKey($key, 'sign'));
                 $this->addSignature($this->getKey($key, 'sign'));
             }
             }
         }
         }
 
 
-        if (!$this->signingKey) {
+        if (! $this->signingKey) {
             throw new RuntimeException('Signing has been enabled, but no signature has been added. Use autoAddSignature() or addSignature()');
             throw new RuntimeException('Signing has been enabled, but no signature has been added. Use autoAddSignature() or addSignature()');
         }
         }
 
 
-        if (!$this->recipientKey) {
+        if (! $this->recipientKey) {
             throw new RuntimeException('Encryption has been enabled, but no recipients have been added. Use autoAddRecipients() or addRecipient()');
             throw new RuntimeException('Encryption has been enabled, but no recipients have been added. Use autoAddRecipients() or addRecipient()');
         }
         }
 
 
@@ -246,19 +244,19 @@ class OpenPGPEncrypter
      */
      */
     protected function initGNUPG()
     protected function initGNUPG()
     {
     {
-        if (!class_exists('gnupg')) {
+        if (! class_exists('gnupg')) {
             throw new RuntimeException('PHPMailerPGP requires the GnuPG class');
             throw new RuntimeException('PHPMailerPGP requires the GnuPG class');
         }
         }
 
 
-        if (!$this->gnupgHome && isset($_SERVER['HOME'])) {
-            $this->gnupgHome = $_SERVER['HOME'] . '/.gnupg';
+        if (! $this->gnupgHome && isset($_SERVER['HOME'])) {
+            $this->gnupgHome = $_SERVER['HOME'].'/.gnupg';
         }
         }
 
 
-        if (!$this->gnupgHome && getenv('HOME')) {
-            $this->gnupgHome = getenv('HOME') . '/.gnupg';
+        if (! $this->gnupgHome && getenv('HOME')) {
+            $this->gnupgHome = getenv('HOME').'/.gnupg';
         }
         }
 
 
-        if (!$this->gnupg) {
+        if (! $this->gnupg) {
             $this->gnupg = new \gnupg();
             $this->gnupg = new \gnupg();
         }
         }
 
 
@@ -268,14 +266,13 @@ class OpenPGPEncrypter
     /**
     /**
      * @param $plaintext
      * @param $plaintext
      * @param $keyFingerprint
      * @param $keyFingerprint
-     *
      * @return string
      * @return string
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
      */
      */
     protected function pgpSignString($plaintext, $keyFingerprint)
     protected function pgpSignString($plaintext, $keyFingerprint)
     {
     {
-        if (isset($this->keyPassphrases[$keyFingerprint]) && !$this->keyPassphrases[$keyFingerprint]) {
+        if (isset($this->keyPassphrases[$keyFingerprint]) && ! $this->keyPassphrases[$keyFingerprint]) {
             $passPhrase = $this->keyPassphrases[$keyFingerprint];
             $passPhrase = $this->keyPassphrases[$keyFingerprint];
         } else {
         } else {
             $passPhrase = null;
             $passPhrase = null;
@@ -298,7 +295,6 @@ class OpenPGPEncrypter
     /**
     /**
      * @param $plaintext
      * @param $plaintext
      * @param $keyFingerprints
      * @param $keyFingerprints
-     *
      * @return string
      * @return string
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
@@ -323,14 +319,13 @@ class OpenPGPEncrypter
     /**
     /**
      * @param $plaintext
      * @param $plaintext
      * @param $keyFingerprints
      * @param $keyFingerprints
-     *
      * @return string
      * @return string
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
      */
      */
     protected function pgpEncryptAndSignString($plaintext, $keyFingerprint, $signingKeyFingerprint)
     protected function pgpEncryptAndSignString($plaintext, $keyFingerprint, $signingKeyFingerprint)
     {
     {
-        if (isset($this->keyPassphrases[$signingKeyFingerprint]) && !$this->keyPassphrases[$signingKeyFingerprint]) {
+        if (isset($this->keyPassphrases[$signingKeyFingerprint]) && ! $this->keyPassphrases[$signingKeyFingerprint]) {
             $passPhrase = $this->keyPassphrases[$signingKeyFingerprint];
             $passPhrase = $this->keyPassphrases[$signingKeyFingerprint];
         } else {
         } else {
             $passPhrase = null;
             $passPhrase = null;
@@ -354,14 +349,13 @@ class OpenPGPEncrypter
     /**
     /**
      * @param $identifier
      * @param $identifier
      * @param $purpose
      * @param $purpose
-     *
      * @return string
      * @return string
      *
      *
      * @throws RuntimeException
      * @throws RuntimeException
      */
      */
     protected function getKey($identifier, $purpose)
     protected function getKey($identifier, $purpose)
     {
     {
-        $keys         = $this->gnupg->keyinfo($identifier);
+        $keys = $this->gnupg->keyinfo($identifier);
         $fingerprints = [];
         $fingerprints = [];
 
 
         foreach ($keys as $key) {
         foreach ($keys as $key) {
@@ -388,6 +382,6 @@ class OpenPGPEncrypter
 
 
     protected function isValidKey($key, $purpose)
     protected function isValidKey($key, $purpose)
     {
     {
-        return !($key['disabled'] || $key['expired'] || $key['revoked'] || ($purpose == 'sign' && !$key['can_sign']) || ($purpose == 'encrypt' && !$key['can_encrypt']));
+        return ! ($key['disabled'] || $key['expired'] || $key['revoked'] || ($purpose == 'sign' && ! $key['can_sign']) || ($purpose == 'encrypt' && ! $key['can_encrypt']));
     }
     }
 }
 }

+ 1 - 1
app/CustomMailDriver/Mime/Encoder/RawContentEncoder.php

@@ -8,7 +8,7 @@ final class RawContentEncoder implements ContentEncoderInterface
 {
 {
     public function encodeByteStream($stream, int $maxLineLength = 0): iterable
     public function encodeByteStream($stream, int $maxLineLength = 0): iterable
     {
     {
-        while (!feof($stream)) {
+        while (! feof($stream)) {
             yield fread($stream, 8192);
             yield fread($stream, 8192);
         }
         }
     }
     }

+ 6 - 2
app/CustomMailDriver/Mime/Part/EncryptedPart.php

@@ -13,16 +13,20 @@ class EncryptedPart extends AbstractPart
     protected $_headers;
     protected $_headers;
 
 
     private $body;
     private $body;
+
     private $charset;
     private $charset;
+
     private $subtype;
     private $subtype;
+
     /**
     /**
      * @var ?string
      * @var ?string
      */
      */
     private $disposition;
     private $disposition;
+
     private $seekable;
     private $seekable;
 
 
     /**
     /**
-     * @param resource|string $body
+     * @param  resource|string  $body
      */
      */
     public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain')
     public function __construct($body, ?string $charset = 'utf-8', string $subtype = 'plain')
     {
     {
@@ -30,7 +34,7 @@ class EncryptedPart extends AbstractPart
 
 
         parent::__construct();
         parent::__construct();
 
 
-        if (!\is_string($body) && !\is_resource($body)) {
+        if (! \is_string($body) && ! \is_resource($body)) {
             throw new \TypeError(sprintf('The body of "%s" must be a string or a resource (got "%s").', self::class, get_debug_type($body)));
             throw new \TypeError(sprintf('The body of "%s" must be a string or a resource (got "%s").', self::class, get_debug_type($body)));
         }
         }
 
 

+ 1 - 0
app/CustomMailDriver/Validation/MessageIDValidation.php

@@ -33,6 +33,7 @@ class MessageIDValidation implements EmailValidation
             // }
             // }
         } catch (\Exception $invalid) {
         } catch (\Exception $invalid) {
             $this->error = new InvalidEmail(new ExceptionFound($invalid), '');
             $this->error = new InvalidEmail(new ExceptionFound($invalid), '');
+
             return false;
             return false;
         }
         }
 
 

+ 2 - 2
app/Exports/AliasesExport.php

@@ -8,8 +8,8 @@ use Maatwebsite\Excel\Concerns\WithHeadings;
 class AliasesExport implements FromCollection, WithHeadings
 class AliasesExport implements FromCollection, WithHeadings
 {
 {
     /**
     /**
-    * @return \Illuminate\Support\Collection
-    */
+     * @return \Illuminate\Support\Collection
+     */
     public function collection()
     public function collection()
     {
     {
         return user()->aliases()->withTrashed()->get();
         return user()->aliases()->withTrashed()->get();

+ 1 - 1
app/Http/Controllers/Api/AccountDetailController.php

@@ -10,7 +10,7 @@ class AccountDetailController extends Controller
     public function index()
     public function index()
     {
     {
         return response()->json([
         return response()->json([
-            'data' => new UserResource(user())
+            'data' => new UserResource(user()),
         ]);
         ]);
     }
     }
 }
 }

+ 6 - 7
app/Http/Controllers/Api/AliasController.php

@@ -83,23 +83,23 @@ class AliasController extends Controller
             }
             }
 
 
             $data = [
             $data = [
-                'email' => $localPart . '@' . $request->domain,
+                'email' => $localPart.'@'.$request->domain,
                 'local_part' => $localPart,
                 'local_part' => $localPart,
-                'extension' => $extension ?? null
+                'extension' => $extension ?? null,
             ];
             ];
         } else {
         } else {
             if ($request->input('format', 'random_characters') === 'random_words') {
             if ($request->input('format', 'random_characters') === 'random_words') {
                 $localPart = user()->generateRandomWordLocalPart();
                 $localPart = user()->generateRandomWordLocalPart();
 
 
                 $data = [
                 $data = [
-                    'email' => $localPart . '@' . $request->domain,
+                    'email' => $localPart.'@'.$request->domain,
                     'local_part' => $localPart,
                     'local_part' => $localPart,
                 ];
                 ];
             } elseif ($request->input('format', 'random_characters') === 'random_characters') {
             } elseif ($request->input('format', 'random_characters') === 'random_characters') {
                 $localPart = user()->generateRandomCharacterLocalPart(8);
                 $localPart = user()->generateRandomCharacterLocalPart(8);
 
 
                 $data = [
                 $data = [
-                    'email' => $localPart . '@' . $request->domain,
+                    'email' => $localPart.'@'.$request->domain,
                     'local_part' => $localPart,
                     'local_part' => $localPart,
                 ];
                 ];
             } else {
             } else {
@@ -107,13 +107,12 @@ class AliasController extends Controller
 
 
                 $data = [
                 $data = [
                     'id' => $uuid,
                     'id' => $uuid,
-                    'email' => $uuid . '@' . $request->domain,
+                    'email' => $uuid.'@'.$request->domain,
                     'local_part' => $uuid,
                     'local_part' => $uuid,
                 ];
                 ];
             }
             }
         }
         }
 
 
-
         // Check if domain is for username or custom domain
         // Check if domain is for username or custom domain
         $parentDomain = collect(config('anonaddy.all_domains'))
         $parentDomain = collect(config('anonaddy.all_domains'))
                     ->filter(function ($name) use ($request) {
                     ->filter(function ($name) use ($request) {
@@ -195,7 +194,7 @@ class AliasController extends Controller
                 'emails_forwarded' => 0,
                 'emails_forwarded' => 0,
                 'emails_blocked' => 0,
                 'emails_blocked' => 0,
                 'emails_replied' => 0,
                 'emails_replied' => 0,
-                'emails_sent' => 0
+                'emails_sent' => 0,
             ]);
             ]);
 
 
             // Soft delete to prevent from being regenerated
             // Soft delete to prevent from being regenerated

+ 1 - 1
app/Http/Controllers/Api/ApiTokenDetailController.php

@@ -18,7 +18,7 @@ class ApiTokenDetailController extends Controller
         return response()->json([
         return response()->json([
             'name' => $token->name,
             'name' => $token->name,
             'created_at' => $token->created_at?->toDateTimeString(),
             'created_at' => $token->created_at?->toDateTimeString(),
-            'expires_at' => $token->expires_at?->toDateTimeString()
+            'expires_at' => $token->expires_at?->toDateTimeString(),
         ]);
         ]);
     }
     }
 }
 }

+ 1 - 1
app/Http/Controllers/Api/DomainController.php

@@ -33,7 +33,7 @@ class DomainController extends Controller
         $domain->domain = $request->domain;
         $domain->domain = $request->domain;
 
 
         if (! $domain->checkVerification()) {
         if (! $domain->checkVerification()) {
-            return response('Verification record not found, please add the following TXT record to your domain: aa-verify=' . sha1(config('anonaddy.secret') . user()->id . user()->domains->count()), 404);
+            return response('Verification record not found, please add the following TXT record to your domain: aa-verify='.sha1(config('anonaddy.secret').user()->id.user()->domains->count()), 404);
         }
         }
 
 
         user()->domains()->save($domain);
         user()->domains()->save($domain);

+ 1 - 1
app/Http/Controllers/Api/DomainOptionController.php

@@ -11,7 +11,7 @@ class DomainOptionController extends Controller
         return response()->json([
         return response()->json([
             'data' => user()->domainOptions(),
             'data' => user()->domainOptions(),
             'defaultAliasDomain' => user()->default_alias_domain,
             'defaultAliasDomain' => user()->default_alias_domain,
-            'defaultAliasFormat' => user()->default_alias_format
+            'defaultAliasFormat' => user()->default_alias_format,
         ]);
         ]);
     }
     }
 }
 }

+ 2 - 2
app/Http/Controllers/Api/FailedDeliveryController.php

@@ -9,7 +9,7 @@ class FailedDeliveryController extends Controller
 {
 {
     public function index()
     public function index()
     {
     {
-        $failedDeliveries = user()->failedDeliveries()->with(['recipient:id,email','alias:id,email'])->latest();
+        $failedDeliveries = user()->failedDeliveries()->with(['recipient:id,email', 'alias:id,email'])->latest();
 
 
         return FailedDeliveryResource::collection($failedDeliveries->get());
         return FailedDeliveryResource::collection($failedDeliveries->get());
     }
     }
@@ -18,7 +18,7 @@ class FailedDeliveryController extends Controller
     {
     {
         $failedDelivery = user()->failedDeliveries()->findOrFail($id);
         $failedDelivery = user()->failedDeliveries()->findOrFail($id);
 
 
-        return new FailedDeliveryResource($failedDelivery->load(['recipient:id,email','alias:id,email']));
+        return new FailedDeliveryResource($failedDelivery->load(['recipient:id,email', 'alias:id,email']));
     }
     }
 
 
     public function destroy($id)
     public function destroy($id)

+ 3 - 3
app/Http/Controllers/Api/RecipientKeyController.php

@@ -21,13 +21,13 @@ class RecipientKeyController extends Controller
 
 
         $info = $this->gnupg->import($request->key_data);
         $info = $this->gnupg->import($request->key_data);
 
 
-        if (!$info || !$info['fingerprint']) {
+        if (! $info || ! $info['fingerprint']) {
             return response('Key could not be imported', 404);
             return response('Key could not be imported', 404);
         }
         }
 
 
         $recipient->update([
         $recipient->update([
             'should_encrypt' => true,
             'should_encrypt' => true,
-            'fingerprint' => $info['fingerprint']
+            'fingerprint' => $info['fingerprint'],
         ]);
         ]);
 
 
         return new RecipientResource($recipient->fresh()->load('aliases'));
         return new RecipientResource($recipient->fresh()->load('aliases'));
@@ -45,7 +45,7 @@ class RecipientKeyController extends Controller
             'protected_headers' => false,
             'protected_headers' => false,
             'inline_encryption' => false,
             'inline_encryption' => false,
             'protected_headers' => false,
             'protected_headers' => false,
-            'fingerprint' => null
+            'fingerprint' => null,
         ]);
         ]);
 
 
         return response('', 204);
         return response('', 204);

+ 1 - 1
app/Http/Controllers/Api/ReorderRuleController.php

@@ -14,7 +14,7 @@ class ReorderRuleController extends Controller
             $rule = Rule::findOrFail($id);
             $rule = Rule::findOrFail($id);
 
 
             $rule->update([
             $rule->update([
-                'order' => $key
+                'order' => $key,
             ]);
             ]);
         });
         });
 
 

+ 2 - 2
app/Http/Controllers/Api/RuleController.php

@@ -37,7 +37,7 @@ class RuleController extends Controller
             'operator' => $request->operator,
             'operator' => $request->operator,
             'forwards' => $request->forwards ?? false,
             'forwards' => $request->forwards ?? false,
             'replies' => $request->replies ?? false,
             'replies' => $request->replies ?? false,
-            'sends' => $request->sends ?? false
+            'sends' => $request->sends ?? false,
         ]);
         ]);
 
 
         return new RuleResource($rule->refresh());
         return new RuleResource($rule->refresh());
@@ -62,7 +62,7 @@ class RuleController extends Controller
             'operator' => $request->operator,
             'operator' => $request->operator,
             'forwards' => $request->forwards ?? false,
             'forwards' => $request->forwards ?? false,
             'replies' => $request->replies ?? false,
             'replies' => $request->replies ?? false,
-            'sends' => $request->sends ?? false
+            'sends' => $request->sends ?? false,
         ]);
         ]);
 
 
         return new RuleResource($rule->refresh());
         return new RuleResource($rule->refresh());

+ 9 - 9
app/Http/Controllers/Auth/ApiAuthenticationController.php

@@ -28,7 +28,7 @@ class ApiAuthenticationController extends Controller
 
 
         if (! $user || ! Hash::check($request->password, $user->password)) {
         if (! $user || ! Hash::check($request->password, $user->password)) {
             return response()->json([
             return response()->json([
-                'error' => 'The provided credentials are incorrect'
+                'error' => 'The provided credentials are incorrect',
             ], 401);
             ], 401);
         }
         }
 
 
@@ -37,18 +37,18 @@ class ApiAuthenticationController extends Controller
             return response()->json([
             return response()->json([
                 'message' => "OTP required, please make a request to /api/auth/mfa with the 'mfa_key', 'otp' and 'device_name' including a 'X-CSRF-TOKEN' header",
                 'message' => "OTP required, please make a request to /api/auth/mfa with the 'mfa_key', 'otp' and 'device_name' including a 'X-CSRF-TOKEN' header",
                 'mfa_key' => Crypt::encryptString($user->id.'|'.config('anonaddy.secret').'|'.Carbon::now()->addMinutes(5)->getTimestamp()),
                 'mfa_key' => Crypt::encryptString($user->id.'|'.config('anonaddy.secret').'|'.Carbon::now()->addMinutes(5)->getTimestamp()),
-                'csrf_token' => csrf_token()
+                'csrf_token' => csrf_token(),
             ], 422);
             ], 422);
         } elseif (Webauthn::enabled($user)) {
         } elseif (Webauthn::enabled($user)) {
             // If WebAuthn is enabled then return currently unsupported message
             // If WebAuthn is enabled then return currently unsupported message
             return response()->json([
             return response()->json([
-                'error' => 'WebAuthn authentication is not currently supported from the extension or mobile apps, please use an API key to login instead'
+                'error' => 'WebAuthn authentication is not currently supported from the extension or mobile apps, please use an API key to login instead',
             ], 403);
             ], 403);
         }
         }
 
 
         // If the user doesn't use 2FA then return the new API key
         // If the user doesn't use 2FA then return the new API key
         return response()->json([
         return response()->json([
-            'api_key' => explode('|', $user->createToken($request->device_name)->plainTextToken, 2)[1]
+            'api_key' => explode('|', $user->createToken($request->device_name)->plainTextToken, 2)[1],
         ]);
         ]);
     }
     }
 
 
@@ -58,7 +58,7 @@ class ApiAuthenticationController extends Controller
             $mfaKey = Crypt::decryptString($request->mfa_key);
             $mfaKey = Crypt::decryptString($request->mfa_key);
         } catch (DecryptException $e) {
         } catch (DecryptException $e) {
             return response()->json([
             return response()->json([
-                'error' => 'Invalid mfa_key'
+                'error' => 'Invalid mfa_key',
             ], 401);
             ], 401);
         }
         }
         $parts = explode('|', $mfaKey, 3);
         $parts = explode('|', $mfaKey, 3);
@@ -67,14 +67,14 @@ class ApiAuthenticationController extends Controller
 
 
         if (! $user || $parts[1] !== config('anonaddy.secret')) {
         if (! $user || $parts[1] !== config('anonaddy.secret')) {
             return response()->json([
             return response()->json([
-                'error' => 'Invalid mfa_key'
+                'error' => 'Invalid mfa_key',
             ], 401);
             ], 401);
         }
         }
 
 
         // Check if the mfa_key has expired
         // Check if the mfa_key has expired
         if (Carbon::now()->getTimestamp() > $parts[2]) {
         if (Carbon::now()->getTimestamp() > $parts[2]) {
             return response()->json([
             return response()->json([
-                'error' => 'mfa_key expired, please request a new one at /api/auth/login'
+                'error' => 'mfa_key expired, please request a new one at /api/auth/login',
             ], 401);
             ], 401);
         }
         }
 
 
@@ -85,7 +85,7 @@ class ApiAuthenticationController extends Controller
 
 
         if (! $timestamp) {
         if (! $timestamp) {
             return response()->json([
             return response()->json([
-                'error' => 'The \'One Time Password\' typed was wrong'
+                'error' => 'The \'One Time Password\' typed was wrong',
             ], 401);
             ], 401);
         }
         }
 
 
@@ -94,7 +94,7 @@ class ApiAuthenticationController extends Controller
         }
         }
 
 
         return response()->json([
         return response()->json([
-            'api_key' => explode('|', $user->createToken($request->device_name)->plainTextToken, 2)[1]
+            'api_key' => explode('|', $user->createToken($request->device_name)->plainTextToken, 2)[1],
         ]);
         ]);
     }
     }
 }
 }

+ 3 - 3
app/Http/Controllers/Auth/BackupCodeController.php

@@ -36,7 +36,7 @@ class BackupCodeController extends Controller
 
 
         if (! Hash::check($request->backup_code, user()->two_factor_backup_code)) {
         if (! Hash::check($request->backup_code, user()->two_factor_backup_code)) {
             return back()->withErrors([
             return back()->withErrors([
-                'backup_code' => __('The backup code was invalid.')
+                'backup_code' => __('The backup code was invalid.'),
             ]);
             ]);
         }
         }
 
 
@@ -45,7 +45,7 @@ class BackupCodeController extends Controller
         user()->update([
         user()->update([
             'two_factor_enabled' => false,
             'two_factor_enabled' => false,
             'two_factor_secret' => $twoFactor->generateSecretKey(),
             'two_factor_secret' => $twoFactor->generateSecretKey(),
-            'two_factor_backup_code' => null
+            'two_factor_backup_code' => null,
         ]);
         ]);
 
 
         user()->webauthnKeys()->delete();
         user()->webauthnKeys()->delete();
@@ -60,7 +60,7 @@ class BackupCodeController extends Controller
     public function update()
     public function update()
     {
     {
         user()->update([
         user()->update([
-            'two_factor_backup_code' => bcrypt($code = Str::random(40))
+            'two_factor_backup_code' => bcrypt($code = Str::random(40)),
         ]);
         ]);
 
 
         return back()->with(['backupCode' => $code]);
         return back()->with(['backupCode' => $code]);

+ 2 - 2
app/Http/Controllers/Auth/PersonalAccessTokenController.php

@@ -18,7 +18,7 @@ class PersonalAccessTokenController extends Controller
     {
     {
         // day, week, month, year or null
         // day, week, month, year or null
         if ($request->expiration) {
         if ($request->expiration) {
-            $method = "add".ucfirst($request->expiration);
+            $method = 'add'.ucfirst($request->expiration);
             $expiration = now()->{$method}();
             $expiration = now()->{$method}();
         } else {
         } else {
             $expiration = null;
             $expiration = null;
@@ -30,7 +30,7 @@ class PersonalAccessTokenController extends Controller
         return [
         return [
             'token' => new PersonalAccessTokenResource($token->accessToken),
             'token' => new PersonalAccessTokenResource($token->accessToken),
             'accessToken' => $accessToken,
             'accessToken' => $accessToken,
-            'qrCode' => (new QRCode())->render(config('app.url') . "|" . $accessToken)
+            'qrCode' => (new QRCode())->render(config('app.url').'|'.$accessToken),
         ];
         ];
     }
     }
 
 

+ 5 - 5
app/Http/Controllers/Auth/RegisterController.php

@@ -63,7 +63,7 @@ class RegisterController extends Controller
                 'max:20',
                 'max:20',
                 'unique:usernames,username',
                 'unique:usernames,username',
                 new NotBlacklisted(),
                 new NotBlacklisted(),
-                new NotDeletedUsername()
+                new NotDeletedUsername(),
             ],
             ],
             'email' => [
             'email' => [
                 'required',
                 'required',
@@ -71,7 +71,7 @@ class RegisterController extends Controller
                 'max:254',
                 'max:254',
                 'confirmed',
                 'confirmed',
                 new RegisterUniqueRecipient(),
                 new RegisterUniqueRecipient(),
-                new NotLocalRecipient()
+                new NotLocalRecipient(),
             ],
             ],
             'password' => ['required', 'min:8'],
             'password' => ['required', 'min:8'],
         ], [
         ], [
@@ -94,12 +94,12 @@ class RegisterController extends Controller
 
 
         $recipient = Recipient::create([
         $recipient = Recipient::create([
             'email' => $data['email'],
             'email' => $data['email'],
-            'user_id' => $userId
+            'user_id' => $userId,
         ]);
         ]);
 
 
         $username = Username::create([
         $username = Username::create([
             'username' => $data['username'],
             'username' => $data['username'],
-            'user_id' => $userId
+            'user_id' => $userId,
         ]);
         ]);
 
 
         $twoFactor = app('pragmarx.google2fa');
         $twoFactor = app('pragmarx.google2fa');
@@ -109,7 +109,7 @@ class RegisterController extends Controller
             'default_username_id' => $username->id,
             'default_username_id' => $username->id,
             'default_recipient_id' => $recipient->id,
             'default_recipient_id' => $recipient->id,
             'password' => Hash::make($data['password']),
             'password' => Hash::make($data['password']),
-            'two_factor_secret' => $twoFactor->generateSecretKey()
+            'two_factor_secret' => $twoFactor->generateSecretKey(),
         ]);
         ]);
     }
     }
 }
 }

+ 5 - 4
app/Http/Controllers/Auth/TwoFactorAuthController.php

@@ -12,6 +12,7 @@ use PragmaRX\Google2FALaravel\Support\Authenticator;
 class TwoFactorAuthController extends Controller
 class TwoFactorAuthController extends Controller
 {
 {
     protected $twoFactor;
     protected $twoFactor;
+
     protected $authenticator;
     protected $authenticator;
 
 
     public function __construct(Request $request)
     public function __construct(Request $request)
@@ -27,7 +28,7 @@ class TwoFactorAuthController extends Controller
 
 
     public function store(EnableTwoFactorAuthRequest $request)
     public function store(EnableTwoFactorAuthRequest $request)
     {
     {
-        if (!$this->twoFactor->verifyKey(user()->two_factor_secret, $request->two_factor_token)) {
+        if (! $this->twoFactor->verifyKey(user()->two_factor_secret, $request->two_factor_token)) {
             return redirect(url()->previous().'#two-factor')->withErrors(['two_factor_token' => 'The token you entered was incorrect']);
             return redirect(url()->previous().'#two-factor')->withErrors(['two_factor_token' => 'The token you entered was incorrect']);
         }
         }
 
 
@@ -35,7 +36,7 @@ class TwoFactorAuthController extends Controller
 
 
         user()->update([
         user()->update([
             'two_factor_enabled' => true,
             'two_factor_enabled' => true,
-            'two_factor_backup_code' => bcrypt($code = Str::random(40))
+            'two_factor_backup_code' => bcrypt($code = Str::random(40)),
         ]);
         ]);
 
 
         $this->authenticator->login();
         $this->authenticator->login();
@@ -56,13 +57,13 @@ class TwoFactorAuthController extends Controller
 
 
     public function destroy(Request $request)
     public function destroy(Request $request)
     {
     {
-        if (!Hash::check($request->current_password_2fa, user()->password)) {
+        if (! Hash::check($request->current_password_2fa, user()->password)) {
             return back()->withErrors(['current_password_2fa' => 'Current password incorrect']);
             return back()->withErrors(['current_password_2fa' => 'Current password incorrect']);
         }
         }
 
 
         user()->update([
         user()->update([
             'two_factor_enabled' => false,
             'two_factor_enabled' => false,
-            'two_factor_secret' => $this->twoFactor->generateSecretKey()
+            'two_factor_secret' => $this->twoFactor->generateSecretKey(),
         ]);
         ]);
 
 
         $this->authenticator->logout();
         $this->authenticator->logout();

+ 1 - 0
app/Http/Controllers/Auth/VerificationController.php

@@ -51,6 +51,7 @@ class VerificationController extends Controller
      *
      *
      * @param  \Illuminate\Http\Request  $request
      * @param  \Illuminate\Http\Request  $request
      * @return \Illuminate\Http\Response
      * @return \Illuminate\Http\Response
+     *
      * @throws \Illuminate\Auth\Access\AuthorizationException
      * @throws \Illuminate\Auth\Access\AuthorizationException
      */
      */
     public function verify(Request $request)
     public function verify(Request $request)

+ 6 - 6
app/Http/Controllers/Auth/WebauthnController.php

@@ -19,7 +19,7 @@ class WebauthnController extends ControllersWebauthnController
 {
 {
     public function index()
     public function index()
     {
     {
-        return user()->webauthnKeys()->latest()->select(['id','name','enabled','created_at'])->get()->values();
+        return user()->webauthnKeys()->latest()->select(['id', 'name', 'enabled', 'created_at'])->get()->values();
     }
     }
 
 
     /**
     /**
@@ -45,7 +45,7 @@ class WebauthnController extends ControllersWebauthnController
     public function store(WebauthnRegisterRequest $request)
     public function store(WebauthnRegisterRequest $request)
     {
     {
         $request->validate([
         $request->validate([
-            'name' => 'required|string|max:50'
+            'name' => 'required|string|max:50',
         ]);
         ]);
 
 
         try {
         try {
@@ -56,7 +56,7 @@ class WebauthnController extends ControllersWebauthnController
             );
             );
 
 
             user()->update([
             user()->update([
-                'two_factor_enabled' => false
+                'two_factor_enabled' => false,
             ]);
             ]);
 
 
             return $this->redirectAfterSuccessRegister();
             return $this->redirectAfterSuccessRegister();
@@ -72,7 +72,7 @@ class WebauthnController extends ControllersWebauthnController
     /**
     /**
      * Return the redirect destination after a successfull register.
      * Return the redirect destination after a successfull register.
      *
      *
-     * @param WebauthnKey $webauthnKey
+     * @param  WebauthnKey  $webauthnKey
      * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
      * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
      */
      */
     protected function redirectAfterSuccessRegister()
     protected function redirectAfterSuccessRegister()
@@ -83,7 +83,7 @@ class WebauthnController extends ControllersWebauthnController
         }
         }
 
 
         user()->update([
         user()->update([
-            'two_factor_backup_code' => bcrypt($code = Str::random(40))
+            'two_factor_backup_code' => bcrypt($code = Str::random(40)),
         ]);
         ]);
 
 
         return Redirect::intended('/settings')->with(['backupCode' => $code]);
         return Redirect::intended('/settings')->with(['backupCode' => $code]);
@@ -92,7 +92,7 @@ class WebauthnController extends ControllersWebauthnController
     /**
     /**
      * Remove an existing Webauthn key.
      * Remove an existing Webauthn key.
      *
      *
-     * @param \Illuminate\Http\Request $request
+     * @param  \Illuminate\Http\Request  $request
      * @return \Illuminate\Http\JsonResponse
      * @return \Illuminate\Http\JsonResponse
      */
      */
     public function destroy(Request $request, $webauthnKeyId)
     public function destroy(Request $request, $webauthnKeyId)

+ 1 - 1
app/Http/Controllers/DeactivateAliasController.php

@@ -22,6 +22,6 @@ class DeactivateAliasController extends Controller
         $alias->deactivate();
         $alias->deactivate();
 
 
         return redirect()->route('aliases.index')
         return redirect()->route('aliases.index')
-            ->with(['status' => 'Alias ' . $alias->email . ' deactivated successfully!']);
+            ->with(['status' => 'Alias '.$alias->email.' deactivated successfully!']);
     }
     }
 }
 }

+ 1 - 1
app/Http/Controllers/DomainVerificationController.php

@@ -17,7 +17,7 @@ class DomainVerificationController extends Controller
         if (! $domain->checkMxRecords()) {
         if (! $domain->checkMxRecords()) {
             return response()->json([
             return response()->json([
                 'success' => false,
                 'success' => false,
-                'message' => 'MX record not found or does not have correct priority. This could be due to DNS caching, please try again later.'
+                'message' => 'MX record not found or does not have correct priority. This could be due to DNS caching, please try again later.',
             ]);
             ]);
         }
         }
 
 

+ 1 - 1
app/Http/Controllers/PasswordController.php

@@ -10,7 +10,7 @@ class PasswordController extends Controller
 {
 {
     public function update(UpdatePasswordRequest $request)
     public function update(UpdatePasswordRequest $request)
     {
     {
-        if (!Hash::check($request->current, user()->password)) {
+        if (! Hash::check($request->current, user()->password)) {
             return redirect(url()->previous().'#update-password')->withErrors(['current' => 'Current password incorrect']);
             return redirect(url()->previous().'#update-password')->withErrors(['current' => 'Current password incorrect']);
         }
         }
 
 

+ 2 - 2
app/Http/Controllers/SettingController.php

@@ -22,13 +22,13 @@ class SettingController extends Controller
             'user' => user(),
             'user' => user(),
             'recipientOptions' => user()->verifiedRecipients,
             'recipientOptions' => user()->verifiedRecipients,
             'authSecret' => user()->two_factor_secret,
             'authSecret' => user()->two_factor_secret,
-            'qrCode' => $qrCode
+            'qrCode' => $qrCode,
         ]);
         ]);
     }
     }
 
 
     public function destroy(DestroyAccountRequest $request)
     public function destroy(DestroyAccountRequest $request)
     {
     {
-        if (!Hash::check($request->current_password_delete, user()->password)) {
+        if (! Hash::check($request->current_password_delete, user()->password)) {
             return back()->withErrors(['current_password_delete' => 'Incorrect password entered']);
             return back()->withErrors(['current_password_delete' => 'Incorrect password entered']);
         }
         }
 
 

+ 4 - 4
app/Http/Controllers/ShowAliasController.php

@@ -10,9 +10,9 @@ class ShowAliasController extends Controller
             ->aliases()
             ->aliases()
             ->withTrashed()
             ->withTrashed()
             ->toBase()
             ->toBase()
-            ->selectRaw("ifnull(sum(emails_forwarded),0) as forwarded")
-            ->selectRaw("ifnull(sum(emails_blocked),0) as blocked")
-            ->selectRaw("ifnull(sum(emails_replied),0) as replies")
+            ->selectRaw('ifnull(sum(emails_forwarded),0) as forwarded')
+            ->selectRaw('ifnull(sum(emails_blocked),0) as blocked')
+            ->selectRaw('ifnull(sum(emails_replied),0) as replies')
             ->first();
             ->first();
 
 
         return view('aliases.index', [
         return view('aliases.index', [
@@ -22,7 +22,7 @@ class ShowAliasController extends Controller
                 ->aliases()
                 ->aliases()
                 ->with([
                 ->with([
                     'recipients:id,email',
                     'recipients:id,email',
-                    'aliasable.defaultRecipient:id,email'
+                    'aliasable.defaultRecipient:id,email',
                 ])
                 ])
                 ->latest()
                 ->latest()
                 ->get(),
                 ->get(),

+ 1 - 1
app/Http/Controllers/ShowDomainController.php

@@ -12,7 +12,7 @@ class ShowDomainController extends Controller
                 ->with('defaultRecipient:id,email')
                 ->with('defaultRecipient:id,email')
                 ->withCount('aliases')
                 ->withCount('aliases')
                 ->latest()
                 ->latest()
-                ->get()
+                ->get(),
         ]);
         ]);
     }
     }
 }
 }

+ 3 - 3
app/Http/Controllers/ShowFailedDeliveryController.php

@@ -9,10 +9,10 @@ class ShowFailedDeliveryController extends Controller
         return view('failed_deliveries.index', [
         return view('failed_deliveries.index', [
             'failedDeliveries' => user()
             'failedDeliveries' => user()
                 ->failedDeliveries()
                 ->failedDeliveries()
-                ->with(['recipient:id,email','alias:id,email'])
-                ->select(['alias_id','bounce_type','code','attempted_at','created_at','id','recipient_id','remote_mta','sender'])
+                ->with(['recipient:id,email', 'alias:id,email'])
+                ->select(['alias_id', 'bounce_type', 'code', 'attempted_at', 'created_at', 'id', 'recipient_id', 'remote_mta', 'sender'])
                 ->latest()
                 ->latest()
-                ->get()
+                ->get(),
         ]);
         ]);
     }
     }
 }
 }

+ 2 - 2
app/Http/Controllers/ShowRecipientController.php

@@ -9,7 +9,7 @@ class ShowRecipientController extends Controller
         $recipients = user()->recipients()->with([
         $recipients = user()->recipients()->with([
             'aliases:id,aliasable_id,email',
             'aliases:id,aliasable_id,email',
             'domainsUsingAsDefault.aliases:id,aliasable_id,email',
             'domainsUsingAsDefault.aliases:id,aliasable_id,email',
-            'usernamesUsingAsDefault.aliases:id,aliasable_id,email'
+            'usernamesUsingAsDefault.aliases:id,aliasable_id,email',
         ])->latest()->get();
         ])->latest()->get();
 
 
         $recipients->each(function ($recipient) {
         $recipients->each(function ($recipient) {
@@ -38,7 +38,7 @@ class ShowRecipientController extends Controller
             'recipients' => $recipients,
             'recipients' => $recipients,
             'aliasesUsingDefault' => user()->aliasesUsingDefault()->take(5)->get(),
             'aliasesUsingDefault' => user()->aliasesUsingDefault()->take(5)->get(),
             'aliasesUsingDefaultCount' => user()->aliasesUsingDefault()->count(),
             'aliasesUsingDefaultCount' => user()->aliasesUsingDefault()->count(),
-            'user' => user()->load('defaultUsername')
+            'user' => user()->load('defaultUsername'),
         ]);
         ]);
     }
     }
 }
 }

+ 1 - 1
app/Http/Controllers/ShowRuleController.php

@@ -10,7 +10,7 @@ class ShowRuleController extends Controller
             'rules' => user()
             'rules' => user()
                 ->rules()
                 ->rules()
                 ->orderBy('order')
                 ->orderBy('order')
-                ->get()
+                ->get(),
         ]);
         ]);
     }
     }
 }
 }

+ 1 - 1
app/Http/Controllers/ShowUsernameController.php

@@ -12,7 +12,7 @@ class ShowUsernameController extends Controller
                 ->with('defaultRecipient:id,email')
                 ->with('defaultRecipient:id,email')
                 ->withCount('aliases')
                 ->withCount('aliases')
                 ->latest()
                 ->latest()
-                ->get()
+                ->get(),
         ]);
         ]);
     }
     }
 }
 }

+ 1 - 1
app/Http/Middleware/VerifyCsrfToken.php

@@ -19,6 +19,6 @@ class VerifyCsrfToken extends Middleware
      * @var array
      * @var array
      */
      */
     protected $except = [
     protected $except = [
-        'api/auth/login'
+        'api/auth/login',
     ];
     ];
 }
 }

+ 1 - 1
app/Http/Middleware/VerifyTwoFactorAuth.php

@@ -26,7 +26,7 @@ class VerifyTwoFactorAuth extends Middleware
 
 
         if (! Str::endsWith($request->url(), '/login/2fa')) {
         if (! Str::endsWith($request->url(), '/login/2fa')) {
             $request->session()->put([
             $request->session()->put([
-                'intended_path' => $request->fullUrl()
+                'intended_path' => $request->fullUrl(),
             ]);
             ]);
         }
         }
 
 

+ 2 - 2
app/Http/Middleware/VerifyWebauthn.php

@@ -19,8 +19,8 @@ class VerifyWebauthn
     /**
     /**
      * Create a Webauthn.
      * Create a Webauthn.
      *
      *
-     * @param \Illuminate\Contracts\Config\Repository $config
-     * @param \Illuminate\Contracts\Auth\Factory $auth
+     * @param  \Illuminate\Contracts\Config\Repository  $config
+     * @param  \Illuminate\Contracts\Auth\Factory  $auth
      */
      */
     public function __construct(AuthFactory $auth)
     public function __construct(AuthFactory $auth)
     {
     {

+ 1 - 1
app/Http/Requests/ApiAuthenticationLoginRequest.php

@@ -26,7 +26,7 @@ class ApiAuthenticationLoginRequest extends FormRequest
         return [
         return [
             'username' => 'required|string',
             'username' => 'required|string',
             'password' => 'required|string',
             'password' => 'required|string',
-            'device_name' => 'required|string|max:50'
+            'device_name' => 'required|string|max:50',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/ApiAuthenticationMfaRequest.php

@@ -26,7 +26,7 @@ class ApiAuthenticationMfaRequest extends FormRequest
         return [
         return [
             'mfa_key' => 'required|string|max:500',
             'mfa_key' => 'required|string|max:500',
             'otp' => 'required|string|min:6|max:6',
             'otp' => 'required|string|min:6|max:6',
-            'device_name' => 'required|string|max:50'
+            'device_name' => 'required|string|max:50',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/DestroyAccountRequest.php

@@ -24,7 +24,7 @@ class DestroyAccountRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'current_password_delete' => 'required|string'
+            'current_password_delete' => 'required|string',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/DisableTwoFactorAuthRequest.php

@@ -24,7 +24,7 @@ class DisableTwoFactorAuthRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'current_password_2fa' => 'required|string'
+            'current_password_2fa' => 'required|string',
         ];
         ];
     }
     }
 }
 }

+ 3 - 3
app/Http/Requests/EditDefaultRecipientRequest.php

@@ -31,8 +31,8 @@ class EditDefaultRecipientRequest extends FormRequest
                 'max:254',
                 'max:254',
                 'confirmed',
                 'confirmed',
                 new RegisterUniqueRecipient(),
                 new RegisterUniqueRecipient(),
-                'not_in:'.$this->user()->email
-            ]
+                'not_in:'.$this->user()->email,
+            ],
         ];
         ];
     }
     }
 
 
@@ -44,7 +44,7 @@ class EditDefaultRecipientRequest extends FormRequest
     public function messages()
     public function messages()
     {
     {
         return [
         return [
-            'email.not_in' => 'That email is the same as the current one.'
+            'email.not_in' => 'That email is the same as the current one.',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/EnableTwoFactorAuthRequest.php

@@ -24,7 +24,7 @@ class EnableTwoFactorAuthRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'two_factor_token' => 'required|min:6'
+            'two_factor_token' => 'required|min:6',
         ];
         ];
     }
     }
 }
 }

+ 7 - 7
app/Http/Requests/IndexAliasRequest.php

@@ -27,27 +27,27 @@ class IndexAliasRequest extends FormRequest
         return [
         return [
             'page' => [
             'page' => [
                 'nullable',
                 'nullable',
-                'array'
+                'array',
             ],
             ],
             'page.number' => [
             'page.number' => [
                 'nullable',
                 'nullable',
-                'integer'
+                'integer',
             ],
             ],
             'page.size' => [
             'page.size' => [
                 'nullable',
                 'nullable',
                 'integer',
                 'integer',
                 'max:100',
                 'max:100',
-                'min:1'
+                'min:1',
             ],
             ],
             'filter' => [
             'filter' => [
                 'nullable',
                 'nullable',
-                'array'
+                'array',
             ],
             ],
             'filter.search' => [
             'filter.search' => [
                 'nullable',
                 'nullable',
                 'string',
                 'string',
                 'max:50',
                 'max:50',
-                'min:3'
+                'min:3',
             ],
             ],
             'filter.deleted' => [
             'filter.deleted' => [
                 'nullable',
                 'nullable',
@@ -86,8 +86,8 @@ class IndexAliasRequest extends FormRequest
                     '-created_at',
                     '-created_at',
                     '-updated_at',
                     '-updated_at',
                     '-deleted_at',
                     '-deleted_at',
-                ])
-            ]
+                ]),
+            ],
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/IndexRecipientRequest.php

@@ -26,7 +26,7 @@ class IndexRecipientRequest extends FormRequest
         return [
         return [
             'filter' => [
             'filter' => [
                 'nullable',
                 'nullable',
-                'array'
+                'array',
             ],
             ],
             'filter.verified' => [
             'filter.verified' => [
                 'nullable',
                 'nullable',

+ 2 - 2
app/Http/Requests/StoreAliasRecipientRequest.php

@@ -28,8 +28,8 @@ class StoreAliasRecipientRequest extends FormRequest
             'recipient_ids' => [
             'recipient_ids' => [
                 'array',
                 'array',
                 'max:10',
                 'max:10',
-                new VerifiedRecipientId()
-            ]
+                new VerifiedRecipientId(),
+            ],
         ];
         ];
     }
     }
 }
 }

+ 5 - 4
app/Http/Requests/StoreAliasRequest.php

@@ -30,7 +30,7 @@ class StoreAliasRequest extends FormRequest
             'domain' => [
             'domain' => [
                 'required',
                 'required',
                 'string',
                 'string',
-                Rule::in($this->user()->domainOptions())
+                Rule::in($this->user()->domainOptions()),
             ],
             ],
             'description' => 'nullable|max:200',
             'description' => 'nullable|max:200',
             'format' => 'nullable|in:random_characters,uuid,random_words,custom',
             'format' => 'nullable|in:random_characters,uuid,random_words,custom',
@@ -38,8 +38,8 @@ class StoreAliasRequest extends FormRequest
                 'nullable',
                 'nullable',
                 'array',
                 'array',
                 'max:10',
                 'max:10',
-                new VerifiedRecipientId()
-            ]
+                new VerifiedRecipientId(),
+            ],
         ];
         ];
     }
     }
 
 
@@ -52,9 +52,10 @@ class StoreAliasRequest extends FormRequest
                 return $query->where('local_part', $this->validationData()['local_part'])
                 return $query->where('local_part', $this->validationData()['local_part'])
                 ->where('domain', $this->validationData()['domain']);
                 ->where('domain', $this->validationData()['domain']);
             }),
             }),
-            new ValidAliasLocalPart()
+            new ValidAliasLocalPart(),
         ], function () {
         ], function () {
             $format = $this->validationData()['format'] ?? 'random_characters';
             $format = $this->validationData()['format'] ?? 'random_characters';
+
             return $format === 'custom';
             return $format === 'custom';
         });
         });
     }
     }

+ 2 - 2
app/Http/Requests/StoreDomainRequest.php

@@ -34,8 +34,8 @@ class StoreDomainRequest extends FormRequest
                 'unique:domains',
                 'unique:domains',
                 new ValidDomain(),
                 new ValidDomain(),
                 new NotLocalDomain(),
                 new NotLocalDomain(),
-                new NotUsedAsRecipientDomain()
-            ]
+                new NotUsedAsRecipientDomain(),
+            ],
         ];
         ];
     }
     }
 }
 }

+ 3 - 3
app/Http/Requests/StorePersonalAccessTokenRequest.php

@@ -27,14 +27,14 @@ class StorePersonalAccessTokenRequest extends FormRequest
             'name' => [
             'name' => [
                 'required',
                 'required',
                 'string',
                 'string',
-                'max:50'
+                'max:50',
             ],
             ],
             'expiration' => [
             'expiration' => [
                 'nullable',
                 'nullable',
                 'string',
                 'string',
                 'max:5',
                 'max:5',
-                'in:day,week,month,year'
-            ]
+                'in:day,week,month,year',
+            ],
         ];
         ];
     }
     }
 }
 }

+ 2 - 2
app/Http/Requests/StoreRecipientRequest.php

@@ -32,8 +32,8 @@ class StoreRecipientRequest extends FormRequest
                 'max:254',
                 'max:254',
                 'email:rfc',
                 'email:rfc',
                 new UniqueRecipient(),
                 new UniqueRecipient(),
-                new NotLocalRecipient()
-            ]
+                new NotLocalRecipient(),
+            ],
         ];
         ];
     }
     }
 }
 }

+ 2 - 2
app/Http/Requests/StoreReorderRuleRequest.php

@@ -28,8 +28,8 @@ class StoreReorderRuleRequest extends FormRequest
             'ids' => [
             'ids' => [
                 'required',
                 'required',
                 'array',
                 'array',
-                new ValidRuleId()
-            ]
+                new ValidRuleId(),
+            ],
         ];
         ];
     }
     }
 }
 }

+ 12 - 12
app/Http/Requests/StoreRuleRequest.php

@@ -28,20 +28,20 @@ class StoreRuleRequest extends FormRequest
             'name' => [
             'name' => [
                 'required',
                 'required',
                 'string',
                 'string',
-                'max:50'
+                'max:50',
             ],
             ],
             'conditions' => [
             'conditions' => [
                 'required',
                 'required',
                 'array',
                 'array',
-                'max:5'
+                'max:5',
             ],
             ],
             'conditions.*.type' => [
             'conditions.*.type' => [
                 'required',
                 'required',
                 Rule::in([
                 Rule::in([
                     'subject',
                     'subject',
                     'sender',
                     'sender',
-                    'alias'
-                ])
+                    'alias',
+                ]),
             ],
             ],
             'conditions.*.match' => [
             'conditions.*.match' => [
                 'sometimes',
                 'sometimes',
@@ -54,14 +54,14 @@ class StoreRuleRequest extends FormRequest
                     'starts with',
                     'starts with',
                     'does not start with',
                     'does not start with',
                     'ends with',
                     'ends with',
-                    'does not end with'
-                ])
+                    'does not end with',
+                ]),
             ],
             ],
             'conditions.*.values' => [
             'conditions.*.values' => [
                 'required',
                 'required',
                 'array',
                 'array',
                 'min:1',
                 'min:1',
-                'max:10'
+                'max:10',
             ],
             ],
             'conditions.*.values.*' => [
             'conditions.*.values.*' => [
                 'distinct',
                 'distinct',
@@ -69,7 +69,7 @@ class StoreRuleRequest extends FormRequest
             'actions' => [
             'actions' => [
                 'required',
                 'required',
                 'array',
                 'array',
-                'max:5'
+                'max:5',
             ],
             ],
             'actions.*.type' => [
             'actions.*.type' => [
                 'required',
                 'required',
@@ -79,20 +79,20 @@ class StoreRuleRequest extends FormRequest
                     'encryption',
                     'encryption',
                     'banner',
                     'banner',
                     'block',
                     'block',
-                    'webhook'
+                    'webhook',
                 ]),
                 ]),
             ],
             ],
             'actions.*.value' => [
             'actions.*.value' => [
                 'required',
                 'required',
-                'max:50'
+                'max:50',
             ],
             ],
             'operator' => [
             'operator' => [
                 'required',
                 'required',
-                'in:AND,OR'
+                'in:AND,OR',
             ],
             ],
             'forwards' => 'boolean',
             'forwards' => 'boolean',
             'replies' => 'boolean',
             'replies' => 'boolean',
-            'sends' => 'boolean'
+            'sends' => 'boolean',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/StoreUsernameRequest.php

@@ -32,7 +32,7 @@ class StoreUsernameRequest extends FormRequest
                 'max:20',
                 'max:20',
                 'unique:usernames,username',
                 'unique:usernames,username',
                 new NotBlacklisted(),
                 new NotBlacklisted(),
-                new NotDeletedUsername()
+                new NotDeletedUsername(),
             ],
             ],
         ];
         ];
     }
     }

+ 1 - 1
app/Http/Requests/UpdateAliasRequest.php

@@ -24,7 +24,7 @@ class UpdateAliasRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'description' => 'nullable|max:200'
+            'description' => 'nullable|max:200',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateBannerLocationRequest.php

@@ -24,7 +24,7 @@ class UpdateBannerLocationRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'banner_location' => 'required|string|in:top,bottom,off'
+            'banner_location' => 'required|string|in:top,bottom,off',
         ];
         ];
     }
     }
 }
 }

+ 2 - 2
app/Http/Requests/UpdateDefaultAliasDomainRequest.php

@@ -28,8 +28,8 @@ class UpdateDefaultAliasDomainRequest extends FormRequest
             'domain' => [
             'domain' => [
                 'required',
                 'required',
                 'string',
                 'string',
-                Rule::in($this->user()->domainOptions())
-            ]
+                Rule::in($this->user()->domainOptions()),
+            ],
         ];
         ];
     }
     }
 }
 }

+ 2 - 2
app/Http/Requests/UpdateDefaultAliasFormatRequest.php

@@ -27,8 +27,8 @@ class UpdateDefaultAliasFormatRequest extends FormRequest
             'format' => [
             'format' => [
                 'required',
                 'required',
                 'string',
                 'string',
-                'in:random_characters,uuid,random_words,custom'
-            ]
+                'in:random_characters,uuid,random_words,custom',
+            ],
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateDefaultRecipientRequest.php

@@ -24,7 +24,7 @@ class UpdateDefaultRecipientRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'default_recipient' => 'required|string'
+            'default_recipient' => 'required|string',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateDomainDefaultRecipientRequest.php

@@ -24,7 +24,7 @@ class UpdateDomainDefaultRecipientRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'default_recipient' => 'nullable|string'
+            'default_recipient' => 'nullable|string',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateDomainRequest.php

@@ -24,7 +24,7 @@ class UpdateDomainRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'description' => 'nullable|max:200'
+            'description' => 'nullable|max:200',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateEmailSubjectRequest.php

@@ -24,7 +24,7 @@ class UpdateEmailSubjectRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'email_subject' => 'nullable|string|max:50'
+            'email_subject' => 'nullable|string|max:50',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateFromNameRequest.php

@@ -24,7 +24,7 @@ class UpdateFromNameRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'from_name' => 'nullable|string|max:50'
+            'from_name' => 'nullable|string|max:50',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdatePasswordRequest.php

@@ -25,7 +25,7 @@ class UpdatePasswordRequest extends FormRequest
     {
     {
         return [
         return [
             'current' => 'required|string',
             'current' => 'required|string',
-            'password' => 'required|confirmed|min:8'
+            'password' => 'required|confirmed|min:8',
         ];
         ];
     }
     }
 }
 }

+ 2 - 2
app/Http/Requests/UpdateRecipientKeyRequest.php

@@ -26,8 +26,8 @@ class UpdateRecipientKeyRequest extends FormRequest
         return [
         return [
             'key_data' => [
             'key_data' => [
                 'string',
                 'string',
-                'regex:/-----BEGIN PGP PUBLIC KEY BLOCK-----([A-Za-z0-9+=\/\n]+)-----END PGP PUBLIC KEY BLOCK-----/i'
-            ]
+                'regex:/-----BEGIN PGP PUBLIC KEY BLOCK-----([A-Za-z0-9+=\/\n]+)-----END PGP PUBLIC KEY BLOCK-----/i',
+            ],
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateUseReplyToRequest.php

@@ -24,7 +24,7 @@ class UpdateUseReplyToRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'use_reply_to' => 'required|boolean'
+            'use_reply_to' => 'required|boolean',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateUsernameDefaultRecipientRequest.php

@@ -24,7 +24,7 @@ class UpdateUsernameDefaultRecipientRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'default_recipient' => 'nullable|string'
+            'default_recipient' => 'nullable|string',
         ];
         ];
     }
     }
 }
 }

+ 1 - 1
app/Http/Requests/UpdateUsernameRequest.php

@@ -24,7 +24,7 @@ class UpdateUsernameRequest extends FormRequest
     public function rules()
     public function rules()
     {
     {
         return [
         return [
-            'description' => 'nullable|max:200'
+            'description' => 'nullable|max:200',
         ];
         ];
     }
     }
 }
 }

+ 4 - 4
app/Http/Resources/UserResource.php

@@ -12,10 +12,10 @@ class UserResource extends JsonResource
             ->aliases()
             ->aliases()
             ->withTrashed()
             ->withTrashed()
             ->toBase()
             ->toBase()
-            ->selectRaw("ifnull(sum(emails_forwarded),0) as forwarded")
-            ->selectRaw("ifnull(sum(emails_blocked),0) as blocked")
-            ->selectRaw("ifnull(sum(emails_replied),0) as replied")
-            ->selectRaw("ifnull(sum(emails_sent),0) as sent")
+            ->selectRaw('ifnull(sum(emails_forwarded),0) as forwarded')
+            ->selectRaw('ifnull(sum(emails_blocked),0) as blocked')
+            ->selectRaw('ifnull(sum(emails_replied),0) as replied')
+            ->selectRaw('ifnull(sum(emails_sent),0) as sent')
             ->first();
             ->first();
 
 
         return [
         return [

+ 1 - 1
app/Listeners/SendIncorrectOtpNotification.php

@@ -25,7 +25,7 @@ class SendIncorrectOtpNotification
             Cache::put("user:{$user->id}:failed-otp-notification", now()->toDateTimeString(), now()->addMinutes(5));
             Cache::put("user:{$user->id}:failed-otp-notification", now()->toDateTimeString(), now()->addMinutes(5));
 
 
             // Log in auth.log
             // Log in auth.log
-            Log::channel('auth')->info('Failed OTP Notification sent: ' . $user->username);
+            Log::channel('auth')->info('Failed OTP Notification sent: '.$user->username);
 
 
             $user->notify(new IncorrectOtpNotification());
             $user->notify(new IncorrectOtpNotification());
         }
         }

+ 40 - 11
app/Mail/ForwardEmail.php

@@ -24,34 +24,63 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
     use CheckUserRules;
     use CheckUserRules;
 
 
     protected $email;
     protected $email;
+
     protected $user;
     protected $user;
+
     protected $alias;
     protected $alias;
+
     protected $sender;
     protected $sender;
+
     protected $originalCc;
     protected $originalCc;
+
     protected $originalTo;
     protected $originalTo;
+
     protected $displayFrom;
     protected $displayFrom;
+
     protected $replyToAddress;
     protected $replyToAddress;
+
     protected $emailSubject;
     protected $emailSubject;
+
     protected $emailText;
     protected $emailText;
+
     protected $emailHtml;
     protected $emailHtml;
+
     protected $emailAttachments;
     protected $emailAttachments;
+
     protected $emailInlineAttachments;
     protected $emailInlineAttachments;
+
     protected $deactivateUrl;
     protected $deactivateUrl;
+
     protected $bannerLocationText;
     protected $bannerLocationText;
+
     protected $bannerLocationHtml;
     protected $bannerLocationHtml;
+
     protected $fingerprint;
     protected $fingerprint;
+
     protected $encryptedParts;
     protected $encryptedParts;
+
     protected $fromEmail;
     protected $fromEmail;
+
     protected $size;
     protected $size;
+
     protected $messageId;
     protected $messageId;
+
     protected $listUnsubscribe;
     protected $listUnsubscribe;
+
     protected $inReplyTo;
     protected $inReplyTo;
+
     protected $references;
     protected $references;
+
     protected $originalEnvelopeFrom;
     protected $originalEnvelopeFrom;
+
     protected $originalFromHeader;
     protected $originalFromHeader;
+
     protected $originalReplyToHeader;
     protected $originalReplyToHeader;
+
     protected $originalSenderHeader;
     protected $originalSenderHeader;
+
     protected $authenticationResults;
     protected $authenticationResults;
+
     protected $recipientId;
     protected $recipientId;
 
 
     /**
     /**
@@ -87,7 +116,7 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
         $this->encryptedParts = $emailData->encryptedParts ?? null;
         $this->encryptedParts = $emailData->encryptedParts ?? null;
         $this->recipientId = $recipient->id;
         $this->recipientId = $recipient->id;
 
 
-        $this->fingerprint = $recipient->should_encrypt && !$this->isAlreadyEncrypted() ? $recipient->fingerprint : null;
+        $this->fingerprint = $recipient->should_encrypt && ! $this->isAlreadyEncrypted() ? $recipient->fingerprint : null;
 
 
         $this->bannerLocationText = $this->bannerLocationHtml = $this->isAlreadyEncrypted() ? 'off' : $this->alias->user->banner_location;
         $this->bannerLocationText = $this->bannerLocationHtml = $this->isAlreadyEncrypted() ? 'off' : $this->alias->user->banner_location;
     }
     }
@@ -103,9 +132,9 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
         if ($this->user->use_reply_to) {
         if ($this->user->use_reply_to) {
             $this->fromEmail = $this->alias->email;
             $this->fromEmail = $this->alias->email;
 
 
-            $replyToEmail = $this->alias->local_part . '+' . Str::replaceLast('@', '=', $this->replyToAddress) . '@' . $this->alias->domain;
+            $replyToEmail = $this->alias->local_part.'+'.Str::replaceLast('@', '=', $this->replyToAddress).'@'.$this->alias->domain;
         } else {
         } else {
-            $this->fromEmail = $this->alias->local_part . '+' . Str::replaceLast('@', '=', $this->replyToAddress) . '@' . $this->alias->domain;
+            $this->fromEmail = $this->alias->local_part.'+'.Str::replaceLast('@', '=', $this->replyToAddress).'@'.$this->alias->domain;
         }
         }
 
 
         $returnPath = $this->alias->email;
         $returnPath = $this->alias->email;
@@ -121,14 +150,14 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             }
             }
         }
         }
 
 
-        $this->email =  $this
+        $this->email = $this
             ->from($this->fromEmail, base64_decode($this->displayFrom)." '".$this->sender."'")
             ->from($this->fromEmail, base64_decode($this->displayFrom)." '".$this->sender."'")
             ->subject($this->user->email_subject ?? base64_decode($this->emailSubject))
             ->subject($this->user->email_subject ?? base64_decode($this->emailSubject))
             ->withSymfonyMessage(function (Email $message) use ($returnPath) {
             ->withSymfonyMessage(function (Email $message) use ($returnPath) {
                 $message->returnPath($returnPath);
                 $message->returnPath($returnPath);
 
 
                 $message->getHeaders()
                 $message->getHeaders()
-                        ->addTextHeader('Feedback-ID', 'F:' . $this->alias->id . ':anonaddy');
+                        ->addTextHeader('Feedback-ID', 'F:'.$this->alias->id.':anonaddy');
 
 
                 // This header is used to set the To: header as the alias just before sending.
                 // This header is used to set the To: header as the alias just before sending.
                 $message->getHeaders()
                 $message->getHeaders()
@@ -211,7 +240,7 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
 
 
         if ($this->emailText) {
         if ($this->emailText) {
             $this->email->text('emails.forward.text')->with([
             $this->email->text('emails.forward.text')->with([
-                'text' => base64_decode($this->emailText)
+                'text' => base64_decode($this->emailText),
             ]);
             ]);
         }
         }
 
 
@@ -220,14 +249,14 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             $this->bannerLocationText = 'off';
             $this->bannerLocationText = 'off';
 
 
             $this->email->view('emails.forward.html')->with([
             $this->email->view('emails.forward.html')->with([
-                'html' => base64_decode($this->emailHtml)
+                'html' => base64_decode($this->emailHtml),
             ]);
             ]);
         }
         }
 
 
         // To prevent invalid view error where no text or html is present...
         // To prevent invalid view error where no text or html is present...
         if (! $this->emailHtml && ! $this->emailText) {
         if (! $this->emailHtml && ! $this->emailText) {
             $this->email->text('emails.forward.text')->with([
             $this->email->text('emails.forward.text')->with([
-                'text' => base64_decode($this->emailText)
+                'text' => base64_decode($this->emailText),
             ]);
             ]);
         }
         }
 
 
@@ -239,7 +268,7 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             );
             );
         }
         }
 
 
-        $this->replacedSubject = $this->user->email_subject ? ' with subject "' . base64_decode($this->emailSubject) . '"' : null;
+        $this->replacedSubject = $this->user->email_subject ? ' with subject "'.base64_decode($this->emailSubject).'"' : null;
 
 
         $this->checkRules('Forwards');
         $this->checkRules('Forwards');
 
 
@@ -256,7 +285,7 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             'fromEmail' => $this->sender,
             'fromEmail' => $this->sender,
             'replacedSubject' => $this->replacedSubject,
             'replacedSubject' => $this->replacedSubject,
             'shouldBlock' => $this->size === 0,
             'shouldBlock' => $this->size === 0,
-            'needsDkimSignature' => $this->needsDkimSignature()
+            'needsDkimSignature' => $this->needsDkimSignature(),
         ]);
         ]);
 
 
         if (isset($replyToEmail)) {
         if (isset($replyToEmail)) {
@@ -306,7 +335,7 @@ class ForwardEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             'email_type' => 'F',
             'email_type' => 'F',
             'status' => null,
             'status' => null,
             'code' => 'An error has occurred, please check the logs.',
             'code' => 'An error has occurred, please check the logs.',
-            'attempted_at' => now()
+            'attempted_at' => now(),
         ]);
         ]);
     }
     }
 
 

+ 22 - 8
app/Mail/ReplyToEmail.php

@@ -23,19 +23,33 @@ class ReplyToEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
     use CheckUserRules;
     use CheckUserRules;
 
 
     protected $email;
     protected $email;
+
     protected $user;
     protected $user;
+
     protected $alias;
     protected $alias;
+
     protected $sender;
     protected $sender;
+
     protected $emailSubject;
     protected $emailSubject;
+
     protected $emailText;
     protected $emailText;
+
     protected $emailHtml;
     protected $emailHtml;
+
     protected $emailAttachments;
     protected $emailAttachments;
+
     protected $emailInlineAttachments;
     protected $emailInlineAttachments;
+
     protected $encryptedParts;
     protected $encryptedParts;
+
     protected $displayFrom;
     protected $displayFrom;
+
     protected $fromEmail;
     protected $fromEmail;
+
     protected $size;
     protected $size;
+
     protected $inReplyTo;
     protected $inReplyTo;
+
     protected $references;
     protected $references;
 
 
     /**
     /**
@@ -77,14 +91,14 @@ class ReplyToEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             }
             }
         }
         }
 
 
-        $this->email =  $this
+        $this->email = $this
             ->from($this->fromEmail, $this->displayFrom)
             ->from($this->fromEmail, $this->displayFrom)
             ->subject(base64_decode($this->emailSubject))
             ->subject(base64_decode($this->emailSubject))
             ->withSymfonyMessage(function (Email $message) use ($returnPath) {
             ->withSymfonyMessage(function (Email $message) use ($returnPath) {
                 $message->returnPath($returnPath);
                 $message->returnPath($returnPath);
 
 
                 $message->getHeaders()
                 $message->getHeaders()
-                        ->addTextHeader('Feedback-ID', 'R:' . $this->alias->id . ':anonaddy');
+                        ->addTextHeader('Feedback-ID', 'R:'.$this->alias->id.':anonaddy');
 
 
                 // Message-ID is replaced on replies as it can leak parts of the real email
                 // Message-ID is replaced on replies as it can leak parts of the real email
                 $message->getHeaders()->remove('Message-ID');
                 $message->getHeaders()->remove('Message-ID');
@@ -117,20 +131,20 @@ class ReplyToEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
 
 
         if ($this->emailText) {
         if ($this->emailText) {
             $this->email->text('emails.reply.text')->with([
             $this->email->text('emails.reply.text')->with([
-                'text' => $this->removeRealEmailAndTextBanner(base64_decode($this->emailText))
+                'text' => $this->removeRealEmailAndTextBanner(base64_decode($this->emailText)),
             ]);
             ]);
         }
         }
 
 
         if ($this->emailHtml) {
         if ($this->emailHtml) {
             $this->email->view('emails.reply.html')->with([
             $this->email->view('emails.reply.html')->with([
-                'html' => $this->removeRealEmailAndHtmlBanner(base64_decode($this->emailHtml))
+                'html' => $this->removeRealEmailAndHtmlBanner(base64_decode($this->emailHtml)),
             ]);
             ]);
         }
         }
 
 
         // To prevent invalid view error where no text or html is present...
         // To prevent invalid view error where no text or html is present...
         if (! $this->emailHtml && ! $this->emailText) {
         if (! $this->emailHtml && ! $this->emailText) {
             $this->email->text('emails.reply.text')->with([
             $this->email->text('emails.reply.text')->with([
-                'text' => base64_decode($this->emailText)
+                'text' => base64_decode($this->emailText),
             ]);
             ]);
         }
         }
 
 
@@ -148,7 +162,7 @@ class ReplyToEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             'shouldBlock' => $this->size === 0,
             'shouldBlock' => $this->size === 0,
             'encryptedParts' => $this->encryptedParts,
             'encryptedParts' => $this->encryptedParts,
             'needsDkimSignature' => $this->needsDkimSignature(),
             'needsDkimSignature' => $this->needsDkimSignature(),
-            'aliasDomain' => $this->alias->domain
+            'aliasDomain' => $this->alias->domain,
         ]);
         ]);
 
 
         if ($this->alias->isCustomDomain() && ! $this->needsDkimSignature()) {
         if ($this->alias->isCustomDomain() && ! $this->needsDkimSignature()) {
@@ -196,7 +210,7 @@ class ReplyToEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             'email_type' => 'R',
             'email_type' => 'R',
             'status' => null,
             'status' => null,
             'code' => 'An error has occurred, please check the logs.',
             'code' => 'An error has occurred, please check the logs.',
-            'attempted_at' => now()
+            'attempted_at' => now(),
         ]);
         ]);
     }
     }
 
 
@@ -216,7 +230,7 @@ class ReplyToEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
         // Reply may be HTML but have a plain text banner
         // Reply may be HTML but have a plain text banner
         return Str::of(str_ireplace($this->sender, '', $html))
         return Str::of(str_ireplace($this->sender, '', $html))
             ->replaceMatches('/(?s)((<|&lt;)!--banner-info--(&gt;|>)).*?((<|&lt;)!--banner-info--(&gt;|>))/mi', '')
             ->replaceMatches('/(?s)((<|&lt;)!--banner-info--(&gt;|>)).*?((<|&lt;)!--banner-info--(&gt;|>))/mi', '')
-            ->replaceMatches("/(?s)(<tr((?!<tr).)*?" . preg_quote(Str::of(config('app.url'))->after('://')->rtrim('/'), '/') . "(\/|%2F)deactivate(\/|%2F).*?\/tr>)/mi", '');
+            ->replaceMatches('/(?s)(<tr((?!<tr).)*?'.preg_quote(Str::of(config('app.url'))->after('://')->rtrim('/'), '/')."(\/|%2F)deactivate(\/|%2F).*?\/tr>)/mi", '');
     }
     }
 
 
     /**
     /**

+ 20 - 8
app/Mail/SendFromEmail.php

@@ -23,17 +23,29 @@ class SendFromEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
     use CheckUserRules;
     use CheckUserRules;
 
 
     protected $email;
     protected $email;
+
     protected $user;
     protected $user;
+
     protected $alias;
     protected $alias;
+
     protected $sender;
     protected $sender;
+
     protected $emailSubject;
     protected $emailSubject;
+
     protected $emailText;
     protected $emailText;
+
     protected $emailHtml;
     protected $emailHtml;
+
     protected $emailAttachments;
     protected $emailAttachments;
+
     protected $emailInlineAttachments;
     protected $emailInlineAttachments;
+
     protected $encryptedParts;
     protected $encryptedParts;
+
     protected $displayFrom;
     protected $displayFrom;
+
     protected $fromEmail;
     protected $fromEmail;
+
     protected $size;
     protected $size;
 
 
     /**
     /**
@@ -73,14 +85,14 @@ class SendFromEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             }
             }
         }
         }
 
 
-        $this->email =  $this
+        $this->email = $this
             ->from($this->fromEmail, $this->displayFrom)
             ->from($this->fromEmail, $this->displayFrom)
             ->subject(base64_decode($this->emailSubject))
             ->subject(base64_decode($this->emailSubject))
             ->withSymfonyMessage(function (Email $message) use ($returnPath) {
             ->withSymfonyMessage(function (Email $message) use ($returnPath) {
                 $message->returnPath($returnPath);
                 $message->returnPath($returnPath);
 
 
                 $message->getHeaders()
                 $message->getHeaders()
-                        ->addTextHeader('Feedback-ID', 'S:' . $this->alias->id . ':anonaddy');
+                        ->addTextHeader('Feedback-ID', 'S:'.$this->alias->id.':anonaddy');
 
 
                 // Message-ID is replaced on send from as it can leak parts of the real email
                 // Message-ID is replaced on send from as it can leak parts of the real email
                 $message->getHeaders()->remove('Message-ID');
                 $message->getHeaders()->remove('Message-ID');
@@ -103,20 +115,20 @@ class SendFromEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
 
 
         if ($this->emailText) {
         if ($this->emailText) {
             $this->email->text('emails.reply.text')->with([
             $this->email->text('emails.reply.text')->with([
-                'text' => $this->removeRealEmailAndTextBanner(base64_decode($this->emailText))
+                'text' => $this->removeRealEmailAndTextBanner(base64_decode($this->emailText)),
             ]);
             ]);
         }
         }
 
 
         if ($this->emailHtml) {
         if ($this->emailHtml) {
             $this->email->view('emails.reply.html')->with([
             $this->email->view('emails.reply.html')->with([
-                'html' => $this->removeRealEmailAndHtmlBanner(base64_decode($this->emailHtml))
+                'html' => $this->removeRealEmailAndHtmlBanner(base64_decode($this->emailHtml)),
             ]);
             ]);
         }
         }
 
 
         // To prevent invalid view error where no text or html is present...
         // To prevent invalid view error where no text or html is present...
         if (! $this->emailHtml && ! $this->emailText) {
         if (! $this->emailHtml && ! $this->emailText) {
             $this->email->text('emails.reply.text')->with([
             $this->email->text('emails.reply.text')->with([
-                'text' => base64_decode($this->emailText)
+                'text' => base64_decode($this->emailText),
             ]);
             ]);
         }
         }
 
 
@@ -134,7 +146,7 @@ class SendFromEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             'shouldBlock' => $this->size === 0,
             'shouldBlock' => $this->size === 0,
             'encryptedParts' => $this->encryptedParts,
             'encryptedParts' => $this->encryptedParts,
             'needsDkimSignature' => $this->needsDkimSignature(),
             'needsDkimSignature' => $this->needsDkimSignature(),
-            'aliasDomain' => $this->alias->domain
+            'aliasDomain' => $this->alias->domain,
         ]);
         ]);
 
 
         if ($this->alias->isCustomDomain() && ! $this->needsDkimSignature()) {
         if ($this->alias->isCustomDomain() && ! $this->needsDkimSignature()) {
@@ -182,7 +194,7 @@ class SendFromEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
             'email_type' => 'S',
             'email_type' => 'S',
             'status' => null,
             'status' => null,
             'code' => 'An error has occurred, please check the logs.',
             'code' => 'An error has occurred, please check the logs.',
-            'attempted_at' => now()
+            'attempted_at' => now(),
         ]);
         ]);
     }
     }
 
 
@@ -202,7 +214,7 @@ class SendFromEmail extends Mailable implements ShouldQueue, ShouldBeEncrypted
         // Reply may be HTML but have a plain text banner
         // Reply may be HTML but have a plain text banner
         return Str::of(str_ireplace($this->sender, '', $html))
         return Str::of(str_ireplace($this->sender, '', $html))
             ->replaceMatches('/(?s)((<|&lt;)!--banner-info--(&gt;|>)).*?((<|&lt;)!--banner-info--(&gt;|>))/mi', '')
             ->replaceMatches('/(?s)((<|&lt;)!--banner-info--(&gt;|>)).*?((<|&lt;)!--banner-info--(&gt;|>))/mi', '')
-            ->replaceMatches("/(?s)(<tr((?!<tr).)*?" . preg_quote(Str::of(config('app.url'))->after('://')->rtrim('/'), '/') . "(\/|%2F)deactivate(\/|%2F).*?\/tr>)/mi", '');
+            ->replaceMatches('/(?s)(<tr((?!<tr).)*?'.preg_quote(Str::of(config('app.url'))->after('://')->rtrim('/'), '/')."(\/|%2F)deactivate(\/|%2F).*?\/tr>)/mi", '');
     }
     }
 
 
     /**
     /**

+ 3 - 2
app/Mail/TokenExpiringSoon.php

@@ -16,6 +16,7 @@ class TokenExpiringSoon extends Mailable implements ShouldQueue, ShouldBeEncrypt
     use SerializesModels;
     use SerializesModels;
 
 
     protected $user;
     protected $user;
+
     protected $recipient;
     protected $recipient;
 
 
     /**
     /**
@@ -37,11 +38,11 @@ class TokenExpiringSoon extends Mailable implements ShouldQueue, ShouldBeEncrypt
     public function build()
     public function build()
     {
     {
         return $this
         return $this
-            ->subject("Your AnonAddy API token expires soon")
+            ->subject('Your AnonAddy API token expires soon')
             ->markdown('mail.token_expiring_soon', [
             ->markdown('mail.token_expiring_soon', [
                 'user' => $this->user,
                 'user' => $this->user,
                 'recipientId' => $this->recipient->id,
                 'recipientId' => $this->recipient->id,
-                'fingerprint' => $this->recipient->should_encrypt ? $this->recipient->fingerprint : null
+                'fingerprint' => $this->recipient->should_encrypt ? $this->recipient->fingerprint : null,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 4 - 4
app/Models/Alias.php

@@ -21,7 +21,7 @@ class Alias extends Model
     protected $keyType = 'string';
     protected $keyType = 'string';
 
 
     protected $encrypted = [
     protected $encrypted = [
-        'description'
+        'description',
     ];
     ];
 
 
     protected $fillable = [
     protected $fillable = [
@@ -38,13 +38,13 @@ class Alias extends Model
         'emails_forwarded',
         'emails_forwarded',
         'emails_blocked',
         'emails_blocked',
         'emails_replied',
         'emails_replied',
-        'emails_sent'
+        'emails_sent',
     ];
     ];
 
 
     protected $dates = [
     protected $dates = [
         'created_at',
         'created_at',
         'updated_at',
         'updated_at',
-        'deleted_at'
+        'deleted_at',
     ];
     ];
 
 
     protected $casts = [
     protected $casts = [
@@ -52,7 +52,7 @@ class Alias extends Model
         'user_id' => 'string',
         'user_id' => 'string',
         'aliasable_id' => 'string',
         'aliasable_id' => 'string',
         'aliasable_type' => 'string',
         'aliasable_type' => 'string',
-        'active' => 'boolean'
+        'active' => 'boolean',
     ];
     ];
 
 
     public static function boot()
     public static function boot()

+ 1 - 1
app/Models/AliasRecipient.php

@@ -20,7 +20,7 @@ class AliasRecipient extends Pivot
     protected $casts = [
     protected $casts = [
         'id' => 'string',
         'id' => 'string',
         'alias_id' => 'string',
         'alias_id' => 'string',
-        'recipient_id' => 'string'
+        'recipient_id' => 'string',
     ];
     ];
 
 
     public function setAliasAttribute($alias)
     public function setAliasAttribute($alias)

+ 2 - 2
app/Models/DeletedUsername.php

@@ -18,10 +18,10 @@ class DeletedUsername extends Model
     public $timestamps = false;
     public $timestamps = false;
 
 
     protected $encrypted = [
     protected $encrypted = [
-        'username'
+        'username',
     ];
     ];
 
 
     protected $fillable = [
     protected $fillable = [
-        'username'
+        'username',
     ];
     ];
 }
 }

+ 19 - 19
app/Models/Domain.php

@@ -20,14 +20,14 @@ class Domain extends Model
     protected $keyType = 'string';
     protected $keyType = 'string';
 
 
     protected $encrypted = [
     protected $encrypted = [
-        'description'
+        'description',
     ];
     ];
 
 
     protected $fillable = [
     protected $fillable = [
         'domain',
         'domain',
         'description',
         'description',
         'active',
         'active',
-        'catch_all'
+        'catch_all',
     ];
     ];
 
 
     protected $dates = [
     protected $dates = [
@@ -35,7 +35,7 @@ class Domain extends Model
         'updated_at',
         'updated_at',
         'domain_verified_at',
         'domain_verified_at',
         'domain_mx_validated_at',
         'domain_mx_validated_at',
-        'domain_sending_verified_at'
+        'domain_sending_verified_at',
     ];
     ];
 
 
     protected $casts = [
     protected $casts = [
@@ -193,9 +193,9 @@ class Domain extends Model
             return true;
             return true;
         }
         }
 
 
-        return collect(dns_get_record($this->domain . '.', DNS_TXT))
+        return collect(dns_get_record($this->domain.'.', DNS_TXT))
             ->contains(function ($r) {
             ->contains(function ($r) {
-                return trim($r['txt']) === 'aa-verify=' . sha1(config('anonaddy.secret') . user()->id . user()->domains->count());
+                return trim($r['txt']) === 'aa-verify='.sha1(config('anonaddy.secret').user()->id.user()->domains->count());
             });
             });
     }
     }
 
 
@@ -208,7 +208,7 @@ class Domain extends Model
             return true;
             return true;
         }
         }
 
 
-        $mx = collect(dns_get_record($this->domain . '.', DNS_MX))
+        $mx = collect(dns_get_record($this->domain.'.', DNS_MX))
             ->sortBy('pri')
             ->sortBy('pri')
             ->first();
             ->first();
 
 
@@ -237,39 +237,39 @@ class Domain extends Model
             ]);
             ]);
         }
         }
 
 
-        $spf = collect(dns_get_record($this->domain . '.', DNS_TXT))
+        $spf = collect(dns_get_record($this->domain.'.', DNS_TXT))
             ->contains(function ($r) {
             ->contains(function ($r) {
-                return preg_match("/^(v=spf1).*(include:spf\." . config('anonaddy.domain') . "|mx).*(-|~)all$/", $r['txt']);
+                return preg_match("/^(v=spf1).*(include:spf\.".config('anonaddy.domain').'|mx).*(-|~)all$/', $r['txt']);
             });
             });
 
 
-        if (!$spf) {
+        if (! $spf) {
             return response()->json([
             return response()->json([
                 'success' => false,
                 'success' => false,
-                'message' => 'SPF record not found. This could be due to DNS caching, please try again later.'
+                'message' => 'SPF record not found. This could be due to DNS caching, please try again later.',
             ]);
             ]);
         }
         }
 
 
-        $dmarc = collect(dns_get_record('_dmarc.' . $this->domain . '.', DNS_TXT))
+        $dmarc = collect(dns_get_record('_dmarc.'.$this->domain.'.', DNS_TXT))
             ->contains(function ($r) {
             ->contains(function ($r) {
-                return preg_match("/^(v=DMARC1).*(p=quarantine|reject).*/", $r['txt']);
+                return preg_match('/^(v=DMARC1).*(p=quarantine|reject).*/', $r['txt']);
             });
             });
 
 
-        if (!$dmarc) {
+        if (! $dmarc) {
             return response()->json([
             return response()->json([
                 'success' => false,
                 'success' => false,
-                'message' => 'DMARC record not found. This could be due to DNS caching, please try again later.'
+                'message' => 'DMARC record not found. This could be due to DNS caching, please try again later.',
             ]);
             ]);
         }
         }
 
 
-        $def = collect(dns_get_record('default._domainkey.' . $this->domain . '.', DNS_CNAME))
+        $def = collect(dns_get_record('default._domainkey.'.$this->domain.'.', DNS_CNAME))
             ->contains(function ($r) {
             ->contains(function ($r) {
-                return $r['target'] === 'default._domainkey.' . config('anonaddy.domain');
+                return $r['target'] === 'default._domainkey.'.config('anonaddy.domain');
             });
             });
 
 
-        if (!$def) {
+        if (! $def) {
             return response()->json([
             return response()->json([
                 'success' => false,
                 'success' => false,
-                'message' => 'CNAME default._domainkey record not found. This could be due to DNS caching, please try again later.'
+                'message' => 'CNAME default._domainkey record not found. This could be due to DNS caching, please try again later.',
             ]);
             ]);
         }
         }
 
 
@@ -278,7 +278,7 @@ class Domain extends Model
         return response()->json([
         return response()->json([
             'success' => true,
             'success' => true,
             'message' => 'Records successfully verified.',
             'message' => 'Records successfully verified.',
-            'data' => new DomainResource($this->fresh())
+            'data' => new DomainResource($this->fresh()),
         ]);
         ]);
     }
     }
 }
 }

+ 4 - 4
app/Models/EmailData.php

@@ -79,10 +79,10 @@ class EmailData
                         ];
                         ];
                     } else {
                     } else {
                         $this->attachments[] = [
                         $this->attachments[] = [
-                          'stream' => base64_encode(stream_get_contents($attachment->getStream())),
-                          'file_name' => base64_encode($attachment->getFileName()),
-                          'mime' => base64_encode($contentType)
-                      ];
+                            'stream' => base64_encode(stream_get_contents($attachment->getStream())),
+                            'file_name' => base64_encode($attachment->getFileName()),
+                            'mime' => base64_encode($contentType),
+                        ];
                     }
                     }
                 }
                 }
             }
             }

+ 4 - 4
app/Models/FailedDelivery.php

@@ -19,7 +19,7 @@ class FailedDelivery extends Model
     protected $keyType = 'string';
     protected $keyType = 'string';
 
 
     protected $encrypted = [
     protected $encrypted = [
-        'sender'
+        'sender',
     ];
     ];
 
 
     protected $fillable = [
     protected $fillable = [
@@ -32,20 +32,20 @@ class FailedDelivery extends Model
         'email_type',
         'email_type',
         'status',
         'status',
         'code',
         'code',
-        'attempted_at'
+        'attempted_at',
     ];
     ];
 
 
     protected $dates = [
     protected $dates = [
         'attempted_at',
         'attempted_at',
         'created_at',
         'created_at',
-        'updated_at'
+        'updated_at',
     ];
     ];
 
 
     protected $casts = [
     protected $casts = [
         'id' => 'string',
         'id' => 'string',
         'user_id' => 'string',
         'user_id' => 'string',
         'recipient_id' => 'string',
         'recipient_id' => 'string',
-        'alias_id' => 'string'
+        'alias_id' => 'string',
     ];
     ];
 
 
     /**
     /**

+ 1 - 1
app/Models/PostfixQueueId.php

@@ -19,7 +19,7 @@ class PostfixQueueId extends Model
 
 
     protected $dates = [
     protected $dates = [
         'created_at',
         'created_at',
-        'updated_at'
+        'updated_at',
     ];
     ];
 
 
     protected $casts = [
     protected $casts = [

+ 4 - 5
app/Models/Recipient.php

@@ -8,7 +8,6 @@ use App\Traits\HasEncryptedAttributes;
 use App\Traits\HasUuid;
 use App\Traits\HasUuid;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Factories\HasFactory;
 use Illuminate\Database\Eloquent\Model;
 use Illuminate\Database\Eloquent\Model;
-
 use Illuminate\Notifications\Notifiable;
 use Illuminate\Notifications\Notifiable;
 
 
 class Recipient extends Model
 class Recipient extends Model
@@ -24,7 +23,7 @@ class Recipient extends Model
 
 
     protected $encrypted = [
     protected $encrypted = [
         'email',
         'email',
-        'fingerprint'
+        'fingerprint',
     ];
     ];
 
 
     protected $fillable = [
     protected $fillable = [
@@ -35,13 +34,13 @@ class Recipient extends Model
         'inline_encryption',
         'inline_encryption',
         'protected_headers',
         'protected_headers',
         'fingerprint',
         'fingerprint',
-        'email_verified_at'
+        'email_verified_at',
     ];
     ];
 
 
     protected $dates = [
     protected $dates = [
         'created_at',
         'created_at',
         'updated_at',
         'updated_at',
-        'email_verified_at'
+        'email_verified_at',
     ];
     ];
 
 
     protected $casts = [
     protected $casts = [
@@ -50,7 +49,7 @@ class Recipient extends Model
         'can_reply_send' => 'boolean',
         'can_reply_send' => 'boolean',
         'should_encrypt' => 'boolean',
         'should_encrypt' => 'boolean',
         'inline_encryption' => 'boolean',
         'inline_encryption' => 'boolean',
-        'protected_headers' => 'boolean'
+        'protected_headers' => 'boolean',
     ];
     ];
 
 
     public static function boot()
     public static function boot()

+ 3 - 3
app/Models/Rule.php

@@ -24,12 +24,12 @@ class Rule extends Model
         'replies',
         'replies',
         'sends',
         'sends',
         'active',
         'active',
-        'order'
+        'order',
     ];
     ];
 
 
     protected $dates = [
     protected $dates = [
         'created_at',
         'created_at',
-        'updated_at'
+        'updated_at',
     ];
     ];
 
 
     protected $casts = [
     protected $casts = [
@@ -40,7 +40,7 @@ class Rule extends Model
         'replies' => 'boolean',
         'replies' => 'boolean',
         'sends' => 'boolean',
         'sends' => 'boolean',
         'conditions' => 'array',
         'conditions' => 'array',
-        'actions' => 'array'
+        'actions' => 'array',
     ];
     ];
 
 
     /**
     /**

+ 7 - 6
app/Models/User.php

@@ -46,13 +46,13 @@ class User extends Authenticatable implements MustVerifyEmail
         'password',
         'password',
         'two_factor_enabled',
         'two_factor_enabled',
         'two_factor_secret',
         'two_factor_secret',
-        'two_factor_backup_code'
+        'two_factor_backup_code',
     ];
     ];
 
 
     protected $encrypted = [
     protected $encrypted = [
         'from_name',
         'from_name',
         'email_subject',
         'email_subject',
-        'two_factor_secret'
+        'two_factor_secret',
     ];
     ];
 
 
     /**
     /**
@@ -64,7 +64,7 @@ class User extends Authenticatable implements MustVerifyEmail
         'password',
         'password',
         'remember_token',
         'remember_token',
         'two_factor_secret',
         'two_factor_secret',
-        'two_factor_backup_code'
+        'two_factor_backup_code',
     ];
     ];
 
 
     /**
     /**
@@ -78,13 +78,13 @@ class User extends Authenticatable implements MustVerifyEmail
         'default_recipient_id' => 'string',
         'default_recipient_id' => 'string',
         'catch_all' => 'boolean',
         'catch_all' => 'boolean',
         'two_factor_enabled' => 'boolean',
         'two_factor_enabled' => 'boolean',
-        'use_reply_to' => 'boolean'
+        'use_reply_to' => 'boolean',
     ];
     ];
 
 
     protected $dates = [
     protected $dates = [
         'created_at',
         'created_at',
         'updated_at',
         'updated_at',
-        'email_verified_at'
+        'email_verified_at',
     ];
     ];
 
 
     /**
     /**
@@ -404,6 +404,7 @@ class User extends Authenticatable implements MustVerifyEmail
                 }
                 }
 
 
                 $withoutExtension = preg_replace('/\+[\s\S]+(?=@)/', '', $recipient->email);
                 $withoutExtension = preg_replace('/\+[\s\S]+(?=@)/', '', $recipient->email);
+
                 return strtolower($withoutExtension);
                 return strtolower($withoutExtension);
             })
             })
             ->contains(strtolower($email));
             ->contains(strtolower($email));
@@ -455,7 +456,7 @@ class User extends Authenticatable implements MustVerifyEmail
 
 
                         $recipientsUsingFingerprint->first()->update([
                         $recipientsUsingFingerprint->first()->update([
                             'should_encrypt' => false,
                             'should_encrypt' => false,
-                            'fingerprint' => null
+                            'fingerprint' => null,
                         ]);
                         ]);
                     }
                     }
                 });
                 });

+ 4 - 3
app/Models/Username.php

@@ -18,7 +18,7 @@ class Username extends Model
     protected $keyType = 'string';
     protected $keyType = 'string';
 
 
     protected $encrypted = [
     protected $encrypted = [
-        'description'
+        'description',
     ];
     ];
 
 
     protected $fillable = [
     protected $fillable = [
@@ -31,7 +31,7 @@ class Username extends Model
 
 
     protected $dates = [
     protected $dates = [
         'created_at',
         'created_at',
-        'updated_at'
+        'updated_at',
     ];
     ];
 
 
     protected $casts = [
     protected $casts = [
@@ -39,7 +39,7 @@ class Username extends Model
         'user_id' => 'string',
         'user_id' => 'string',
         'active' => 'boolean',
         'active' => 'boolean',
         'catch_all' => 'boolean',
         'catch_all' => 'boolean',
-        'default_recipient_id' => 'string'
+        'default_recipient_id' => 'string',
     ];
     ];
 
 
     public static function boot()
     public static function boot()
@@ -83,6 +83,7 @@ class Username extends Model
     {
     {
         return $this->hasOne(Recipient::class, 'id', 'default_recipient_id');
         return $this->hasOne(Recipient::class, 'id', 'default_recipient_id');
     }
     }
+
     /**
     /**
      * Set the usernames's default recipient.
      * Set the usernames's default recipient.
      */
      */

+ 1 - 1
app/Notifications/CustomVerifyEmail.php

@@ -40,7 +40,7 @@ class CustomVerifyEmail extends VerifyEmail implements ShouldQueue, ShouldBeEncr
             ->subject(Lang::get('Verify Email Address'))
             ->subject(Lang::get('Verify Email Address'))
             ->markdown('mail.verify_email', [
             ->markdown('mail.verify_email', [
                 'verificationUrl' => $verificationUrl,
                 'verificationUrl' => $verificationUrl,
-                'recipientId' => $recipientId
+                'recipientId' => $recipientId,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) use ($feedbackId) {
             ->withSymfonyMessage(function (Email $message) use ($feedbackId) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 2 - 2
app/Notifications/DefaultRecipientUpdated.php

@@ -45,12 +45,12 @@ class DefaultRecipientUpdated extends Notification implements ShouldQueue, Shoul
     public function toMail($notifiable)
     public function toMail($notifiable)
     {
     {
         return (new MailMessage())
         return (new MailMessage())
-            ->subject("Your default recipient has just been updated")
+            ->subject('Your default recipient has just been updated')
             ->markdown('mail.default_recipient_updated', [
             ->markdown('mail.default_recipient_updated', [
                 'defaultRecipient' => $notifiable->email,
                 'defaultRecipient' => $notifiable->email,
                 'newDefaultRecipient' => $this->newDefaultRecipient,
                 'newDefaultRecipient' => $this->newDefaultRecipient,
                 'recipientId' => $notifiable->id,
                 'recipientId' => $notifiable->id,
-                'fingerprint' => $notifiable->should_encrypt ? $notifiable->fingerprint : null
+                'fingerprint' => $notifiable->should_encrypt ? $notifiable->fingerprint : null,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 5 - 2
app/Notifications/DisallowedReplySendAttempt.php

@@ -15,8 +15,11 @@ class DisallowedReplySendAttempt extends Notification implements ShouldQueue, Sh
     use Queueable;
     use Queueable;
 
 
     protected $aliasEmail;
     protected $aliasEmail;
+
     protected $recipient;
     protected $recipient;
+
     protected $destination;
     protected $destination;
+
     protected $authenticationResults;
     protected $authenticationResults;
 
 
     /**
     /**
@@ -26,7 +29,7 @@ class DisallowedReplySendAttempt extends Notification implements ShouldQueue, Sh
      */
      */
     public function __construct($alias, $recipient, $authenticationResults)
     public function __construct($alias, $recipient, $authenticationResults)
     {
     {
-        $this->aliasEmail = $alias['local_part'] . '@' . $alias['domain'];
+        $this->aliasEmail = $alias['local_part'].'@'.$alias['domain'];
         $this->recipient = $recipient;
         $this->recipient = $recipient;
         $this->destination = Str::replaceLast('=', '@', $alias['extension']);
         $this->destination = Str::replaceLast('=', '@', $alias['extension']);
         $this->authenticationResults = $authenticationResults;
         $this->authenticationResults = $authenticationResults;
@@ -61,7 +64,7 @@ class DisallowedReplySendAttempt extends Notification implements ShouldQueue, Sh
                 'destination' => $this->destination,
                 'destination' => $this->destination,
                 'authenticationResults' => $this->authenticationResults,
                 'authenticationResults' => $this->authenticationResults,
                 'recipientId' => $notifiable->id,
                 'recipientId' => $notifiable->id,
-                'fingerprint' => $fingerprint
+                'fingerprint' => $fingerprint,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 1 - 1
app/Notifications/DomainMxRecordsInvalid.php

@@ -52,7 +52,7 @@ class DomainMxRecordsInvalid extends Notification implements ShouldQueue, Should
             ->markdown('mail.domain_mx_records_invalid', [
             ->markdown('mail.domain_mx_records_invalid', [
                 'domain' => $this->domain,
                 'domain' => $this->domain,
                 'recipientId' => $recipient->_id,
                 'recipientId' => $recipient->_id,
-                'fingerprint' => $fingerprint
+                'fingerprint' => $fingerprint,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 3 - 2
app/Notifications/DomainUnverifiedForSending.php

@@ -14,6 +14,7 @@ class DomainUnverifiedForSending extends Notification implements ShouldQueue, Sh
     use Queueable;
     use Queueable;
 
 
     protected $domain;
     protected $domain;
+
     protected $reason;
     protected $reason;
 
 
     /**
     /**
@@ -50,12 +51,12 @@ class DomainUnverifiedForSending extends Notification implements ShouldQueue, Sh
         $fingerprint = $recipient->should_encrypt ? $recipient->fingerprint : null;
         $fingerprint = $recipient->should_encrypt ? $recipient->fingerprint : null;
 
 
         return (new MailMessage())
         return (new MailMessage())
-            ->subject("Your domain has been unverified for sending on AnonAddy")
+            ->subject('Your domain has been unverified for sending on AnonAddy')
             ->markdown('mail.domain_unverified_for_sending', [
             ->markdown('mail.domain_unverified_for_sending', [
                 'domain' => $this->domain,
                 'domain' => $this->domain,
                 'reason' => $this->reason,
                 'reason' => $this->reason,
                 'recipientId' => $recipient->id,
                 'recipientId' => $recipient->id,
-                'fingerprint' => $fingerprint
+                'fingerprint' => $fingerprint,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 4 - 2
app/Notifications/FailedDeliveryNotification.php

@@ -13,7 +13,9 @@ class FailedDeliveryNotification extends Notification implements ShouldQueue, Sh
     use Queueable;
     use Queueable;
 
 
     protected $aliasEmail;
     protected $aliasEmail;
+
     protected $originalSender;
     protected $originalSender;
+
     protected $originalSubject;
     protected $originalSubject;
 
 
     /**
     /**
@@ -48,13 +50,13 @@ class FailedDeliveryNotification extends Notification implements ShouldQueue, Sh
     public function toMail($notifiable)
     public function toMail($notifiable)
     {
     {
         return (new MailMessage())
         return (new MailMessage())
-                    ->subject("New failed delivery on AnonAddy")
+                    ->subject('New failed delivery on AnonAddy')
                     ->markdown('mail.failed_delivery_notification', [
                     ->markdown('mail.failed_delivery_notification', [
                         'aliasEmail' => $this->aliasEmail,
                         'aliasEmail' => $this->aliasEmail,
                         'originalSender' => $this->originalSender,
                         'originalSender' => $this->originalSender,
                         'originalSubject' => $this->originalSubject,
                         'originalSubject' => $this->originalSubject,
                         'recipientId' => $notifiable->id,
                         'recipientId' => $notifiable->id,
-                        'fingerprint' => $notifiable->should_encrypt ? $notifiable->fingerprint : null
+                        'fingerprint' => $notifiable->should_encrypt ? $notifiable->fingerprint : null,
                     ])
                     ])
                     ->withSymfonyMessage(function ($message) {
                     ->withSymfonyMessage(function ($message) {
                         $message->getHeaders()
                         $message->getHeaders()

+ 2 - 2
app/Notifications/GpgKeyExpired.php

@@ -33,9 +33,9 @@ class GpgKeyExpired extends Notification implements ShouldQueue, ShouldBeEncrypt
     public function toMail($notifiable)
     public function toMail($notifiable)
     {
     {
         return (new MailMessage())
         return (new MailMessage())
-            ->subject("Your GPG key has expired on AnonAddy")
+            ->subject('Your GPG key has expired on AnonAddy')
             ->markdown('mail.gpg_key_expired', [
             ->markdown('mail.gpg_key_expired', [
-                'recipient' => $notifiable
+                'recipient' => $notifiable,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 2 - 2
app/Notifications/IncorrectOtpNotification.php

@@ -36,12 +36,12 @@ class IncorrectOtpNotification extends Notification implements ShouldQueue, Shou
         $fingerprint = $recipient->should_encrypt ? $recipient->fingerprint : null;
         $fingerprint = $recipient->should_encrypt ? $recipient->fingerprint : null;
 
 
         return (new MailMessage())
         return (new MailMessage())
-            ->subject("Failed Two Factor Authentication Login Attempt")
+            ->subject('Failed Two Factor Authentication Login Attempt')
             ->markdown('mail.failed_login_attempt', [
             ->markdown('mail.failed_login_attempt', [
                 'recipientId' => $recipient->id,
                 'recipientId' => $recipient->id,
                 'hasVerifiedEmail' => $recipient->hasVerifiedEmail(),
                 'hasVerifiedEmail' => $recipient->hasVerifiedEmail(),
                 'fingerprint' => $fingerprint,
                 'fingerprint' => $fingerprint,
-                'username' => $notifiable->username
+                'username' => $notifiable->username,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

+ 2 - 1
app/Notifications/NearBandwidthLimit.php

@@ -14,6 +14,7 @@ class NearBandwidthLimit extends Notification implements ShouldQueue, ShouldBeEn
     use Queueable;
     use Queueable;
 
 
     protected $month;
     protected $month;
+
     protected $reset;
     protected $reset;
 
 
     /**
     /**
@@ -57,7 +58,7 @@ class NearBandwidthLimit extends Notification implements ShouldQueue, ShouldBeEn
             'month' => $this->month,
             'month' => $this->month,
             'reset' => $this->reset,
             'reset' => $this->reset,
             'recipientId' => $recipient->id,
             'recipientId' => $recipient->id,
-            'fingerprint' => $fingerprint
+            'fingerprint' => $fingerprint,
         ])
         ])
         ->withSymfonyMessage(function (Email $message) {
         ->withSymfonyMessage(function (Email $message) {
             $message->getHeaders()
             $message->getHeaders()

+ 5 - 2
app/Notifications/SpamReplySendAttempt.php

@@ -15,8 +15,11 @@ class SpamReplySendAttempt extends Notification implements ShouldQueue, ShouldBe
     use Queueable;
     use Queueable;
 
 
     protected $aliasEmail;
     protected $aliasEmail;
+
     protected $recipient;
     protected $recipient;
+
     protected $destination;
     protected $destination;
+
     protected $authenticationResults;
     protected $authenticationResults;
 
 
     /**
     /**
@@ -26,7 +29,7 @@ class SpamReplySendAttempt extends Notification implements ShouldQueue, ShouldBe
      */
      */
     public function __construct($alias, $recipient, $authenticationResults)
     public function __construct($alias, $recipient, $authenticationResults)
     {
     {
-        $this->aliasEmail = $alias['local_part'] . '@' . $alias['domain'];
+        $this->aliasEmail = $alias['local_part'].'@'.$alias['domain'];
         $this->recipient = $recipient;
         $this->recipient = $recipient;
         $this->destination = Str::replaceLast('=', '@', $alias['extension']);
         $this->destination = Str::replaceLast('=', '@', $alias['extension']);
         $this->authenticationResults = $authenticationResults;
         $this->authenticationResults = $authenticationResults;
@@ -59,7 +62,7 @@ class SpamReplySendAttempt extends Notification implements ShouldQueue, ShouldBe
                 'destination' => $this->destination,
                 'destination' => $this->destination,
                 'authenticationResults' => $this->authenticationResults,
                 'authenticationResults' => $this->authenticationResults,
                 'recipientId' => $notifiable->id,
                 'recipientId' => $notifiable->id,
-                'fingerprint' => $notifiable->should_encrypt ? $notifiable->fingerprint : null
+                'fingerprint' => $notifiable->should_encrypt ? $notifiable->fingerprint : null,
             ])
             ])
             ->withSymfonyMessage(function (Email $message) {
             ->withSymfonyMessage(function (Email $message) {
                 $message->getHeaders()
                 $message->getHeaders()

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini