Browse Source

Fixed parentDomain bug

Will Browning 5 years ago
parent
commit
6d81de50e4

+ 14 - 12
app/Console/Commands/ReceiveEmail.php

@@ -81,24 +81,26 @@ class ReceiveEmail extends Command
                     })
                     ->first();
 
-                $subdomain = substr($recipient['domain'], 0, strrpos($recipient['domain'], '.'.$parentDomain));
+                if ($parentDomain) {
+                    $subdomain = substr($recipient['domain'], 0, strrpos($recipient['domain'], '.'.$parentDomain));
 
-                if ($subdomain === 'unsubscribe') {
-                    $this->handleUnsubscribe($recipient);
-                    continue;
-                }
-
-                $user = User::where('username', $subdomain)->first();
-
-                if (is_null($user)) {
-                    // Check if this is a custom domain.
-                    if ($customDomain = Domain::where('domain', $recipient['domain'])->first()) {
-                        $user = $customDomain->user;
+                    if ($subdomain === 'unsubscribe') {
+                        $this->handleUnsubscribe($recipient);
+                        continue;
                     }
 
                     // Check if this is an additional username.
                     if ($additionalUsername = AdditionalUsername::where('username', $subdomain)->first()) {
                         $user = $additionalUsername->user;
+                    } else {
+                        $user = User::where('username', $subdomain)->first();
+                    }
+                }
+
+                if (!isset($user)) {
+                    // Check if this is a custom domain.
+                    if ($customDomain = Domain::where('domain', $recipient['domain'])->first()) {
+                        $user = $customDomain->user;
                     }
 
                     // Check if this is a uuid generated alias.

+ 1 - 1
resources/views/auth/register.blade.php

@@ -40,7 +40,7 @@
 
                         <div class="flex flex-wrap mb-6">
                             <label for="email" class="block text-grey-700 text-sm mb-2">
-                                {{ __('Email') }}:
+                                Default Recipient Email::
                             </label>
 
                             <input id="email" type="email" class="appearance-none bg-grey-100 rounded w-full p-3 text-grey-700 focus:shadow-outline{{ $errors->has('email') ? ' border-red-500' : '' }}" name="email" value="{{ old('email') }}" placeholder="johndoe@example.com" required>

+ 1 - 1
resources/views/auth/verify.blade.php

@@ -20,7 +20,7 @@
 
                     <div class="w-full flex flex-wrap mt-8">
                         <p class="leading-normal mb-6 text-center">
-                            {{ __('Before proceeding, please check your email for a verification link.') }}
+                            {{ __('Before proceeding, please check your email for a verification link.') }} This link will expire after 1 hour.
                         </p>
 
                         <a class="bg-cyan-400 w-full text-center hover:bg-cyan-300 text-cyan-900 font-bold py-3 px-4 rounded focus:shadow-outline no-underline mx-auto" href="{{ route('verification.resend') }}">