1 minute wait for admins
This commit is contained in:
parent
8454361c30
commit
79322e522b
|
|
@ -19,6 +19,13 @@ class KeyController extends Controller
|
|||
if (!$fetchKeys->isEmpty()) {
|
||||
if ($activeKey->created_at->addWeek()->gt(Carbon::now())) {
|
||||
$canCreate = false;
|
||||
if (User::isAdmin()) {
|
||||
if ($activeKey->created_at->addMinute()->gt(Carbon::now())) {
|
||||
$canCreate = false;
|
||||
} else {
|
||||
$canCreate = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$canCreate = true;
|
||||
}
|
||||
|
|
@ -41,7 +48,7 @@ class KeyController extends Controller
|
|||
|
||||
// Validation
|
||||
if (!$fetchKeys->isEmpty() && $activeKey->created_at->addWeek()->gt(Carbon::now())) {
|
||||
if (!User::isAdmin())
|
||||
if (!User::isAdmin() || $activeKey->created_at->addMinute()->gt(Carbon::now()))
|
||||
abort(404);
|
||||
}
|
||||
|
||||
|
|
@ -53,4 +60,4 @@ class KeyController extends Controller
|
|||
|
||||
return redirect()->route('key_index');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,17 +6,16 @@
|
|||
|
||||
@section('content')
|
||||
<h1 id="usernameframe">Create a Key</h1>
|
||||
@if ($data['canCreate'] || App\Models\User::isAdmin())
|
||||
@if ($data['canCreate'])
|
||||
<p>You may create @if ($data['fetchKeys']->isEmpty()) your first key below!
|
||||
@else
|
||||
@if (App\Models\User::isAdmin()) as many keys as you wish because you're an admin. @else a new key because it's been 1 week since creating your last key. @endif @endif
|
||||
@if (App\Models\User::isAdmin()) a new key every minute because you're an admin. @else a new key because it's been 1 week since creating your last key. @endif @endif
|
||||
</p>
|
||||
@else
|
||||
<p>You cannot create a new key because 1 week hasn't passed since creating your last key. You can find your
|
||||
key(s) below.</p>
|
||||
<p>@if (App\Models\User::isAdmin()) You cannot create a new key because 1 minute hasn't passed since creating your last key. You can find your key(s) below.. @else You cannot create a new key because 1 week hasn't passed since creating your last key. You can find your key(s) below. @endif</p>
|
||||
@endif
|
||||
<br>
|
||||
@if ($data['canCreate'] || App\Models\User::isAdmin())
|
||||
@if ($data['canCreate'])
|
||||
<form method="POST" action="{{ route('key_create') }}">
|
||||
@csrf
|
||||
<button class="bluebutton" type="submit">Create Invite Key</button>
|
||||
|
|
|
|||
|
|
@ -160,7 +160,8 @@
|
|||
<div class="content_special"
|
||||
style="flex-wrap: wrap; flex-direction: column; width: 50%; align-content: flex-start;">
|
||||
<h3>Invite Keys</h3>
|
||||
<p>You can only create 1 invite every week. <br>Manage your keys and key history below.</p>
|
||||
<p>@if (App\Models\User::isAdmin()) You can create 1 key per minute. @else You can create 1 key per week. @endif</p>
|
||||
<p>Manage your keys and key history below.</p>
|
||||
<p><button class="bluebutton"><a href="{{ route('key_index') }}"
|
||||
style="font-weight:normal;color:#fff">Create
|
||||
Invite Key</a></button></p>
|
||||
|
|
|
|||
Loading…
Reference in New Issue