Skip to content

Commit 6d970a4

Browse files
committed
Finalize login page!
1 parent d63624f commit 6d970a4

File tree

10 files changed

+40
-16
lines changed

10 files changed

+40
-16
lines changed

app/Http/Controllers/Auth/LoginController.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,23 @@
44

55
use Illuminate\Http\Request;
66
use Illuminate\Http\JsonResponse;
7+
use Illuminate\Contracts\View\View;
78
use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
89

910
class LoginController extends AbstractLoginController
1011
{
12+
/**
13+
* Handle all incoming requests for the authentication routes and render the
14+
* base authentication view component. Vuejs will take over at this point and
15+
* turn the login area into a SPA.
16+
*
17+
* @return \Illuminate\Contracts\View\View
18+
*/
19+
public function index(): View
20+
{
21+
return view('templates/auth.core');
22+
}
23+
1124
/**
1225
* Handle a login request to the application.
1326
*

app/Providers/AppServiceProvider.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Pterodactyl\Models\User;
88
use Pterodactyl\Models\Server;
99
use Pterodactyl\Models\Subuser;
10+
use Illuminate\Support\Facades\Blade;
1011
use Illuminate\Support\Facades\Schema;
1112
use Igaster\LaravelTheme\Facades\Theme;
1213
use Illuminate\Support\ServiceProvider;
@@ -21,6 +22,7 @@ class AppServiceProvider extends ServiceProvider
2122
*/
2223
public function boot()
2324
{
25+
Blade::doubleEncode();
2426
Schema::defaultStringLength(191);
2527

2628
User::observe(UserObserver::class);

resources/assets/pterodactyl/scripts/app.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ Vue.i18n.add('en', Locales.en);
4343
Vue.i18n.set('en');
4444

4545
const router = new VueRouter({
46+
mode: 'history',
4647
routes: [
4748
{
4849
name: 'login',
49-
path: '/',
50+
path: '/auth/login',
5051
component: Login,
5152
},
5253
{
5354
name: 'forgot-password',
54-
path: '/forgot-password',
55+
path: '/auth/password',
5556
component: Login,
5657
},
5758
{
@@ -61,7 +62,7 @@ const router = new VueRouter({
6162
},
6263
{
6364
name: 'reset-password',
64-
path: '/reset-password/:token',
65+
path: '/auth/password/reset/:token',
6566
component: ResetPassword,
6667
props: function (route) {
6768
return {

resources/assets/pterodactyl/scripts/components/auth/ForgotPassword.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
</button>
3232
</div>
3333
<div class="pt-6 text-center">
34-
<router-link to="/" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark">
34+
<router-link class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"
35+
:to="{ name: 'login' }"
36+
>
3537
{{ $t('auth.go_to_login') }}
3638
</router-link>
3739
</div>

resources/assets/pterodactyl/scripts/components/auth/ResetPassword.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@
5050
</button>
5151
</div>
5252
<div class="pt-6 text-center">
53-
<router-link to="/" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark">
53+
<router-link class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"
54+
:to="{ name: 'login' }"
55+
>
5456
{{ $t('auth.go_to_login') }}
5557
</router-link>
5658
</div>

resources/assets/pterodactyl/scripts/components/auth/TwoFactorForm.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
</div>
1919
<div class="pt-6 text-center">
2020
<router-link class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"
21-
:to="{ name: 'login' }">
21+
:to="{ name: 'login' }"
22+
>
2223
Back to Login
2324
</router-link>
2425
</div>

resources/lang/en/strings.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,7 @@
8484
'sat' => 'Saturday',
8585
],
8686
'last_used' => 'Last Used',
87+
88+
// Copyright Line
89+
'copyright' => '&copy; 2015 - :year Pterodactyl Software',
8790
];

resources/themes/pterodactyl/auth/login.blade.php

Lines changed: 0 additions & 5 deletions
This file was deleted.

resources/themes/pterodactyl/templates/auth/core.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<html>
22
<head>
3-
<title>{{ config('app.name', 'Pterodactyl') }} - @yield('title')</title>
3+
<title>{{ config('app.name', 'Pterodactyl') }}</title>
44

55
@section('meta')
66
<meta charset="utf-8">
@@ -23,7 +23,7 @@
2323
</div>
2424
<router-view></router-view>
2525
<p class="text-center text-grey text-xs">
26-
&copy; 2015 - {{ date('Y') }} Pterodactyl Software
26+
{{ trans('strings.copyright', ['year' => date('Y')]) }}
2727
</p>
2828
</div>
2929
</div>

routes/auth.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
|
1010
*/
1111
Route::group(['middleware' => 'guest'], function () {
12-
// Login specific routes
13-
Route::get('/login', 'LoginController@showLoginForm')->name('auth.login');
12+
// These routes are defined so that we can continue to reference them programatically.
13+
// They all route to the same controller function which passes off to Vuejs.
14+
Route::get('/login', 'LoginController@index')->name('auth.login');
15+
Route::get('/password', 'LoginController@index')->name('auth.forgot-password');
16+
Route::get('/password/reset/{token}', 'LoginController@index')->name('auth.reset');
17+
18+
// Login endpoints.
1419
Route::post('/login', 'LoginController@login')->middleware('recaptcha');
1520
Route::post('/login/checkpoint', 'LoginCheckpointController')->name('auth.login-checkpoint');
1621

1722
// Forgot password route. A post to this endpoint will trigger an
1823
// email to be sent containing a reset token.
19-
Route::post('/password', 'ForgotPasswordController@sendResetLinkEmail')->name('auth.forgot-password')->middleware('recaptcha');
24+
Route::post('/password', 'ForgotPasswordController@sendResetLinkEmail')->middleware('recaptcha');
2025

2126
// Password reset routes. This endpoint is hit after going through
2227
// the forgot password routes to acquire a token (or after an account

0 commit comments

Comments
 (0)