File tree Expand file tree Collapse file tree 2 files changed +9
-0
lines changed
app/Http/Controllers/Base Expand file tree Collapse file tree 2 files changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
55
66## v0.7.17 (Derelict Dermodactylus)
77### Fixed
8+ * Limited accounts to 5 API keys at a time.
89* Fixes database passwords not being generated with the proper requirements for some MySQL setups.
910* Hostnames that are not FQDNs/IP addresses can now be used for connecting to a MySQL host.
1011
Original file line number Diff line number Diff line change 77use Illuminate \Http \Response ;
88use Pterodactyl \Models \ApiKey ;
99use Prologue \Alerts \AlertsMessageBag ;
10+ use Pterodactyl \Exceptions \DisplayException ;
1011use Pterodactyl \Http \Controllers \Controller ;
1112use Pterodactyl \Services \Api \KeyCreationService ;
1213use Pterodactyl \Http \Requests \Base \StoreAccountKeyRequest ;
@@ -76,10 +77,17 @@ public function create(Request $request): View
7677 * @param \Pterodactyl\Http\Requests\Base\StoreAccountKeyRequest $request
7778 * @return \Illuminate\Http\RedirectResponse
7879 *
80+ * @throws \Pterodactyl\Exceptions\DisplayException
7981 * @throws \Pterodactyl\Exceptions\Model\DataValidationException
8082 */
8183 public function store (StoreAccountKeyRequest $ request )
8284 {
85+ if ($ this ->repository ->findCountWhere (['user_id ' => $ request ->user ()->id ]) >= 5 ) {
86+ throw new DisplayException (
87+ 'Cannot assign more than 5 API keys to an account. '
88+ );
89+ }
90+
8391 $ this ->keyService ->setKeyType (ApiKey::TYPE_ACCOUNT )->handle ([
8492 'user_id ' => $ request ->user ()->id ,
8593 'allowed_ips ' => $ request ->input ('allowed_ips ' ),
You can’t perform that action at this time.
0 commit comments