Skip to content

Commit 008cccb

Browse files
committed
Fix up email sending and add more notifications to the panel.
Closes pterodactyl#265
1 parent 95171a3 commit 008cccb

File tree

23 files changed

+489
-122
lines changed

23 files changed

+489
-122
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,16 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
88
* `[pre.2]` — Fixes bug where servers could not be manually deployed to nodes due to a broken SQL call.
99
* `[pre.2]` — Fixes inability to edit a server due to owner_id issues.
1010
* `[pre.2]` — Fixes bug when trying to add new subusers.
11+
* Emails sending with 'Pterodactyl Panel' as the from name. Now configurable by using `php artisan pterodactyl:mail` to update.
1112

1213
### Changed
1314
* `[pre.2]` — File Manager now displays relevant information on all screen sizes, and includes better button clicking mechanics for dropdown menu.
1415
* Reduced the number of database queries being executed when viewing a specific server. This is done by caching the query for up to 60 minutes in memcached.
1516
* User creation emails include more information and are sent by the event listener rather than the repository.
1617

18+
### Added
19+
* Notifications when a user is added or removed as a subuser for a server.
20+
1721
## v0.6.0-pre.2 (Courageous Carniadactylus)
1822
### Fixed
1923
* `[pre.1]` — Fixes bug with database seeders that prevented correctly installing the panel.

app/Console/Commands/UpdateEmailSettings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ class UpdateEmailSettings extends Command
3636
protected $signature = 'pterodactyl:mail
3737
{--driver=}
3838
{--email=}
39+
{--from-name=}
3940
{--host=}
4041
{--port=}
4142
{--username=}
@@ -137,6 +138,7 @@ public function handle()
137138
}
138139

139140
$variables['MAIL_FROM'] = is_null($this->option('email')) ? $this->ask('Email address emails should originate from') : $this->option('email');
141+
$variables['MAIL_FROM_NAME'] = is_null($this->option('from-name')) ? $this->ask('Name emails should appear to be from') : $this->option('from-name');
140142
$variables['MAIL_ENCRYPTION'] = 'tls';
141143

142144
$bar = $this->output->createProgressBar(count($variables));

app/Events/Subuser/Created.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace Pterodactyl\Events\Subuser;
26+
27+
use Pterodactyl\Models\Subuser;
28+
use Illuminate\Queue\SerializesModels;
29+
30+
class Created
31+
{
32+
use SerializesModels;
33+
34+
public $subuser;
35+
36+
/**
37+
* Create a new event instance.
38+
*
39+
* @return void
40+
*/
41+
public function __construct(Subuser $subuser)
42+
{
43+
$this->subuser = $subuser;
44+
}
45+
}

app/Events/Subuser/Creating.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace Pterodactyl\Events\Subuser;
26+
27+
use Pterodactyl\Models\Subuser;
28+
use Illuminate\Queue\SerializesModels;
29+
30+
class Creating
31+
{
32+
use SerializesModels;
33+
34+
public $subuser;
35+
36+
/**
37+
* Create a new event instance.
38+
*
39+
* @return void
40+
*/
41+
public function __construct(Subuser $subuser)
42+
{
43+
$this->subuser = $subuser;
44+
}
45+
}

app/Events/Subuser/Deleted.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace Pterodactyl\Events\Subuser;
26+
27+
use Pterodactyl\Models\Subuser;
28+
use Illuminate\Queue\SerializesModels;
29+
30+
class Deleted
31+
{
32+
use SerializesModels;
33+
34+
public $subuser;
35+
36+
/**
37+
* Create a new event instance.
38+
*
39+
* @return void
40+
*/
41+
public function __construct(Subuser $subuser)
42+
{
43+
$this->subuser = $subuser;
44+
}
45+
}

app/Events/Subuser/Deleting.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
/**
3+
* Pterodactyl - Panel
4+
* Copyright (c) 2015 - 2017 Dane Everitt <dane@daneeveritt.com>.
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
namespace Pterodactyl\Events\Subuser;
26+
27+
use Pterodactyl\Models\Subuser;
28+
use Illuminate\Queue\SerializesModels;
29+
30+
class Deleting
31+
{
32+
use SerializesModels;
33+
34+
public $subuser;
35+
36+
/**
37+
* Create a new event instance.
38+
*
39+
* @return void
40+
*/
41+
public function __construct(Subuser $subuser)
42+
{
43+
$this->subuser = $subuser;
44+
}
45+
}

app/Http/Routes/ServerRoutes.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public function map(Router $router)
129129
]);
130130

131131
$router->delete('users/delete/{id}', [
132+
'as' => 'server.subusers.delete',
132133
'uses' => 'Server\SubuserController@deleteSubuser',
133134
]);
134135

app/Models/Server.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -85,25 +85,6 @@ class Server extends Model
8585
'installed' => 'integer',
8686
];
8787

88-
/**
89-
* @var array
90-
*/
91-
protected static $serverUUIDInstance = [];
92-
93-
/**
94-
* @var mixed
95-
*/
96-
protected static $user;
97-
98-
/**
99-
* Constructor.
100-
*/
101-
public function __construct()
102-
{
103-
parent::__construct();
104-
self::$user = Auth::user();
105-
}
106-
10788
/**
10889
* Returns a single server specified by UUID.
10990
* DO NOT USE THIS TO MODIFY SERVER DETAILS OR SAVE THOSE DETAILS.

app/Models/Subuser.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,12 @@
2525
namespace Pterodactyl\Models;
2626

2727
use Illuminate\Database\Eloquent\Model;
28+
use Illuminate\Notifications\Notifiable;
2829

2930
class Subuser extends Model
3031
{
32+
use Notifiable;
33+
3134
/**
3235
* The table associated with the model.
3336
*

app/Notifications/AccountCreated.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class AccountCreated extends Notification implements ShouldQueue
4747
*/
4848
public function __construct(array $user)
4949
{
50-
$this->user = $user;
50+
$this->user = (object) $user;
5151
}
5252

5353
/**

0 commit comments

Comments
 (0)