Skip to content

Commit 81d265d

Browse files
committed
Prevent the irritating moment when you logout accidentally when trying to click Admin CP.
1 parent 1c5f892 commit 81d265d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

resources/themes/pterodactyl/layouts/admin.blade.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@
7979
<li><a href="{{ route('index') }}" data-toggle="tooltip" data-placement="bottom" title="Exit Admin Control"><i class="fa fa-server"></i></a></li>
8080
</li>
8181
<li>
82-
<li><a href="{{ route('auth.logout') }}" data-toggle="tooltip" data-placement="bottom" title="Logout"><i class="fa fa-power-off"></i></a></li>
82+
<li><a href="{{ route('auth.logout') }}" id="logoutButton" data-toggle="tooltip" data-placement="bottom" title="Logout"><i class="fa fa-power-off"></i></a></li>
8383
</li>
8484
</ul>
8585
</div>
@@ -191,6 +191,17 @@
191191
{!! Theme::js('vendor/select2/select2.full.min.js') !!}
192192
{!! Theme::js('js/admin/functions.js') !!}
193193
{!! Theme::js('js/autocomplete.js') !!}
194+
195+
@if(Auth::user()->isRootAdmin())
196+
<script>
197+
$('#logoutButton').on('click', function (event) {
198+
event.preventDefault();
199+
if (confirm('Are you sure you want to logout?')) {
200+
window.location = $(this).attr('href');
201+
}
202+
});
203+
</script>
204+
@endif
194205
@show
195206
</body>
196207
</html>

resources/themes/pterodactyl/layouts/master.blade.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
</li>
8484
@endif
8585
<li>
86-
<li><a href="{{ route('auth.logout') }}" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.logout') }}"><i class="fa fa-power-off"></i></a></li>
86+
<li><a href="{{ route('auth.logout') }}" id="logoutButton" data-toggle="tooltip" data-placement="bottom" title="{{ @trans('strings.logout') }}"><i class="fa fa-power-off"></i></a></li>
8787
</li>
8888
</ul>
8989
</div>
@@ -283,6 +283,17 @@ class="active"
283283
@if(config('pterodactyl.lang.in_context'))
284284
{!! Theme::js('vendor/phraseapp/phraseapp.js') !!}
285285
@endif
286+
287+
@if(Auth::user()->isRootAdmin())
288+
<script>
289+
$('#logoutButton').on('click', function (event) {
290+
event.preventDefault();
291+
if (confirm('Are you sure you want to logout?')) {
292+
window.location = $(this).attr('href');
293+
}
294+
});
295+
</script>
296+
@endif
286297
@show
287298
</body>
288299
</html>

0 commit comments

Comments
 (0)