diff --git a/app/Http/Controllers/SettingsController.php b/app/Http/Controllers/SettingsController.php
index 121143b677..464246a969 100755
--- a/app/Http/Controllers/SettingsController.php
+++ b/app/Http/Controllers/SettingsController.php
@@ -22,6 +22,7 @@ use App\Http\Requests\SetupUserRequest;
use App\Http\Requests\ImageUploadRequest;
use App\Http\Requests\SettingsLdapRequest;
use App\Helpers\Helper;
+use App\Notifications\FirstAdminNotification;
/**
* This controller handles all actions related to Settings for
@@ -186,11 +187,20 @@ class SettingsController extends Controller
$settings->save();
if (Input::get('email_creds')=='1') {
- Mail::send(['text' => 'emails.firstadmin'], $data, function ($m) use ($data) {
+ $data = array();
+ $data['email'] = $user->email;
+ $data['username'] = $user->username;
+ $data['first_name'] = $user->first_name;
+ $data['last_name'] = $user->last_name;
+ $data['password'] = $user->password;
+
+ $user->notify(new FirstAdminNotification($data));
+
+ /*Mail::send(['text' => 'emails.firstadmin'], $data, function ($m) use ($data) {
$m->to($data['email'], $data['first_name']);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject(trans('mail.your_credentials'));
- });
+ });*/
}
diff --git a/app/Http/Controllers/UsersController.php b/app/Http/Controllers/UsersController.php
index 8d7ae3cdb4..ee2164f94f 100755
--- a/app/Http/Controllers/UsersController.php
+++ b/app/Http/Controllers/UsersController.php
@@ -147,6 +147,7 @@ class UsersController extends Controller
$data['email'] = e($request->input('email'));
$data['username'] = e($request->input('username'));
$data['first_name'] = e($request->input('first_name'));
+ $data['last_name'] = e($request->input('last_name'));
$data['password'] = e($request->input('password'));
$user->notify(new WelcomeNotification($data));
@@ -197,6 +198,7 @@ class UsersController extends Controller
$data['email'] = $request->input('email');
$data['username'] = $request->input('username');
$data['first_name'] = $request->input('first_name');
+ $data['last_name'] = e($request->input('last_name'));
$data['password'] = $request->input('password');
$user->notify(new WelcomeNotification($data));
@@ -860,6 +862,7 @@ class UsersController extends Controller
$data['email'] = trim(e($row[4]));
$data['username'] = trim(e($row[2]));
$data['first_name'] = trim(e($row[0]));
+ $data['last_name'] = trim(e($row[1]));
$data['password'] = $pass;
if ($newuser['email']) {
diff --git a/app/Notifications/FirstAdminNotification.php b/app/Notifications/FirstAdminNotification.php
new file mode 100644
index 0000000000..bf802070da
--- /dev/null
+++ b/app/Notifications/FirstAdminNotification.php
@@ -0,0 +1,67 @@
+_data['email'] = $content['email'];
+ $this->_data['first_name'] = $content['first_name'];
+ $this->_data['last_name'] = $content['last_name'];
+ $this->_data['username'] = $content['username'];
+ $this->_data['password'] = $content['password'];
+ $this->_data['url'] = url('/');
+ }
+
+ /**
+ * Get the notification's delivery channels.
+ *
+ * @param mixed $notifiable
+ * @return array
+ */
+ public function via($notifiable)
+ {
+ return ['mail'];
+ }
+
+ /**
+ * Get the mail representation of the notification.
+ *
+ * @param mixed $notifiable
+ * @return \Illuminate\Notifications\Messages\MailMessage
+ */
+ public function toMail($notifiable)
+ {
+ return (new MailMessage)
+ ->subject(trans('mail.welcome', ['name' => $this->_data['first_name'] . ' ' . $this->_data['last_name'] ]))
+ ->markdown('notifications.FirstAdmin', $this->_data);
+ }
+
+ /**
+ * Get the array representation of the notification.
+ *
+ * @param mixed $notifiable
+ * @return array
+ */
+ public function toArray($notifiable)
+ {
+ return [
+ //
+ ];
+ }
+}
diff --git a/app/Notifications/WelcomeNotification.php b/app/Notifications/WelcomeNotification.php
index cc778b9cdf..837a4e6d8b 100644
--- a/app/Notifications/WelcomeNotification.php
+++ b/app/Notifications/WelcomeNotification.php
@@ -22,6 +22,7 @@ class WelcomeNotification extends Notification
{
$this->_data['email'] = $content['email'];
$this->_data['first_name'] = $content['first_name'];
+ $this->_data['last_name'] = $content['last_name'];
$this->_data['username'] = $content['username'];
$this->_data['password'] = $content['password'];
$this->_data['url'] = url('/');
@@ -47,7 +48,7 @@ class WelcomeNotification extends Notification
public function toMail($notifiable)
{
return (new MailMessage)
- ->subject(trans('mail.welcome', ['name' => $this->_data['first_name'] ]))
+ ->subject(trans('mail.welcome', ['name' => $this->_data['first_name'] . ' ' . $this->_data['last_name'] ]))
->markdown('notifications.Welcome', $this->_data);
}
diff --git a/resources/views/notifications/FirstAdmin.blade.php b/resources/views/notifications/FirstAdmin.blade.php
new file mode 100644
index 0000000000..f6d9202bb2
--- /dev/null
+++ b/resources/views/notifications/FirstAdmin.blade.php
@@ -0,0 +1,17 @@
+@component('mail::message')
+{{ trans('mail.hello') }} {{ $first_name }} {{$last_name}},
+
+{{ trans('mail.login') }} {{ $username }}
+{{ trans('mail.password') }} {{ $password }}
+
+@component('mail::button', ['url' => $url])
+Go To {{$snipeSettings->site_name}}
+@endcomponent
+
+{{ trans('mail.best_regards') }}
+@if ($snipeSettings->show_url_in_emails=='1')
+
{{ $snipeSettings->site_name }}
+@else +{{ $snipeSettings->site_name }}
+@endif +@endcomponent diff --git a/resources/views/notifications/Welcome.blade.php b/resources/views/notifications/Welcome.blade.php index fb41854352..7501a81bb8 100644 --- a/resources/views/notifications/Welcome.blade.php +++ b/resources/views/notifications/Welcome.blade.php @@ -1,5 +1,5 @@ @component('mail::message') -{{ trans('mail.hello') }} {{ $first_name }}, +{{ trans('mail.hello') }} {{ $first_name }} {{$last_name}}, {{ trans('mail.admin_has_created', ['web' => $snipeSettings->site_name]) }}