diff --git a/app/Http/Controllers/Auth/ActivateController.php b/app/Http/Controllers/Auth/ActivateController.php
index 63cabea..ec80827 100644
--- a/app/Http/Controllers/Auth/ActivateController.php
+++ b/app/Http/Controllers/Auth/ActivateController.php
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
+use App\Traits\ActivatesUsers;
use App\User;
use Illuminate\Foundation\Auth\RedirectsUsers;
use Illuminate\Http\Request;
@@ -10,7 +11,7 @@ use Illuminate\Support\Facades\App;
class ActivateController extends Controller
{
- use RedirectsUsers;
+ use RedirectsUsers, ActivatesUsers;
/**
* Where to redirect users after activation.
@@ -46,6 +47,8 @@ class ActivateController extends Controller
$request->session()->flash('info', trans('auth.account_activated_message'));
+ $this->sendUserActivatedEmails($user);
+
return redirect($this->redirectPath());
}
}
\ No newline at end of file
diff --git a/app/Http/Controllers/Auth/RegisterController.php b/app/Http/Controllers/Auth/RegisterController.php
index 1155fa7..badeb5a 100644
--- a/app/Http/Controllers/Auth/RegisterController.php
+++ b/app/Http/Controllers/Auth/RegisterController.php
@@ -7,6 +7,7 @@ use App\Facade\UserConfig;
use App\Helpers\MiscHelper;
use App\Helpers\RecaptchaHelper;
use App\Mail\UserActivationRequired;
+use App\Traits\ActivatesUsers;
use App\User;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Mail;
@@ -27,7 +28,7 @@ class RegisterController extends Controller
|
*/
- use RegistersUsers;
+ use RegistersUsers, ActivatesUsers;
/**
* Where to redirect users after login / registration.
@@ -127,6 +128,7 @@ class RegisterController extends Controller
if ($user->is_activated)
{
+ $this->sendUserActivatedEmails($user);
$this->guard()->login($user);
}
else
diff --git a/app/Mail/UserSelfActivated.php b/app/Mail/UserSelfActivated.php
new file mode 100644
index 0000000..cca206b
--- /dev/null
+++ b/app/Mail/UserSelfActivated.php
@@ -0,0 +1,48 @@
+user = $user;
+ $this->createdUser = $createdUser;
+ }
+
+ /**
+ * Build the message.
+ *
+ * @return $this
+ */
+ public function build()
+ {
+ $subject = trans('email.user_self_activated_subject', ['app_name' => UserConfig::get('app_name')]);
+
+ return $this
+ ->subject($subject)
+ ->markdown(Theme::viewName('email.user_self_activated'))
+ ->with([
+ 'subject' => $subject,
+ 'user' => $this->user,
+ 'created_user' => $this->createdUser
+ ]);
+ }
+}
\ No newline at end of file
diff --git a/app/Traits/ActivatesUsers.php b/app/Traits/ActivatesUsers.php
new file mode 100644
index 0000000..93caf08
--- /dev/null
+++ b/app/Traits/ActivatesUsers.php
@@ -0,0 +1,21 @@
+get();
+
+ /** @var User $adminUser */
+ foreach ($adminUsers as $adminUser)
+ {
+ Mail::to($adminUser)->send(new UserSelfActivated($adminUser, $createdUser));
+ }
+ }
+}
\ No newline at end of file
diff --git a/resources/lang/en/email.php b/resources/lang/en/email.php
index f42da70..5842358 100644
--- a/resources/lang/en/email.php
+++ b/resources/lang/en/email.php
@@ -29,5 +29,9 @@ return [
'photo_comment_replied_to_comment_label' => 'Comments:',
'photo_comment_replied_to_p1' => 'A reply to your comment has been posted in the :album_name album.',
'photo_comment_replied_to_p2' => 'Click the button below to view the photo\'s page to see the reply to your comment.',
- 'photo_comment_replied_to_subject' => 'A reply to your comment was posted in :album_name'
+ 'photo_comment_replied_to_subject' => 'A reply to your comment was posted in :album_name',
+ 'user_self_activated_p1' => 'A new user has been created and activated at :app_name. The user\'s details are shown below.',
+ 'user_self_activated_p2' => 'Name: :user_name',
+ 'user_self_activated_p3' => 'E-mail address: :email_address',
+ 'user_self_activated_subject' => 'New user created at :app_name'
];
\ No newline at end of file
diff --git a/resources/views/themes/base/email/user_self_activated.blade.php b/resources/views/themes/base/email/user_self_activated.blade.php
new file mode 100644
index 0000000..105ca24
--- /dev/null
+++ b/resources/views/themes/base/email/user_self_activated.blade.php
@@ -0,0 +1,17 @@
+@component('mail::message')
+@lang('email.generic_intro', ['user_name' => $user->name])
+
+
+@lang('email.user_self_activated_p1', ['app_name' => UserConfig::get('app_name')])
+
+
+@lang('email.user_self_activated_p2', ['user_name' => $created_user->name])
+
+
+@lang('email.user_self_activated_p3', ['email_address' => $created_user->email])
+
+
+@lang('email.generic_regards')
+{{ UserConfig::get('app_name') }}
+{{ route('home') }}
+@endcomponent
\ No newline at end of file