diff --git a/app/Http/Controllers/Auth/LoginController.php b/app/Http/Controllers/Auth/LoginController.php index 522a994f6..5a3a3ffb6 100644 --- a/app/Http/Controllers/Auth/LoginController.php +++ b/app/Http/Controllers/Auth/LoginController.php @@ -4,10 +4,23 @@ namespace Pterodactyl\Http\Controllers\Auth; use Illuminate\Http\Request; use Illuminate\Http\JsonResponse; +use Illuminate\Contracts\View\View; use Pterodactyl\Exceptions\Repository\RecordNotFoundException; class LoginController extends AbstractLoginController { + /** + * Handle all incoming requests for the authentication routes and render the + * base authentication view component. Vuejs will take over at this point and + * turn the login area into a SPA. + * + * @return \Illuminate\Contracts\View\View + */ + public function index(): View + { + return view('templates/auth.core'); + } + /** * Handle a login request to the application. * diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 1adede6c6..04c6b75d6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -7,6 +7,7 @@ use Cache; use Pterodactyl\Models\User; use Pterodactyl\Models\Server; use Pterodactyl\Models\Subuser; +use Illuminate\Support\Facades\Blade; use Illuminate\Support\Facades\Schema; use Igaster\LaravelTheme\Facades\Theme; use Illuminate\Support\ServiceProvider; @@ -21,6 +22,7 @@ class AppServiceProvider extends ServiceProvider */ public function boot() { + Blade::doubleEncode(); Schema::defaultStringLength(191); User::observe(UserObserver::class); diff --git a/resources/assets/pterodactyl/scripts/app.js b/resources/assets/pterodactyl/scripts/app.js index b2e62753e..5586874a6 100644 --- a/resources/assets/pterodactyl/scripts/app.js +++ b/resources/assets/pterodactyl/scripts/app.js @@ -43,15 +43,16 @@ Vue.i18n.add('en', Locales.en); Vue.i18n.set('en'); const router = new VueRouter({ + mode: 'history', routes: [ { name: 'login', - path: '/', + path: '/auth/login', component: Login, }, { name: 'forgot-password', - path: '/forgot-password', + path: '/auth/password', component: Login, }, { @@ -61,7 +62,7 @@ const router = new VueRouter({ }, { name: 'reset-password', - path: '/reset-password/:token', + path: '/auth/password/reset/:token', component: ResetPassword, props: function (route) { return { diff --git a/resources/assets/pterodactyl/scripts/components/auth/ForgotPassword.vue b/resources/assets/pterodactyl/scripts/components/auth/ForgotPassword.vue index 22d00c843..97029e1ce 100644 --- a/resources/assets/pterodactyl/scripts/components/auth/ForgotPassword.vue +++ b/resources/assets/pterodactyl/scripts/components/auth/ForgotPassword.vue @@ -31,7 +31,9 @@
- © 2015 - {{ date('Y') }} Pterodactyl Software + {{ trans('strings.copyright', ['year' => date('Y')]) }}
diff --git a/routes/auth.php b/routes/auth.php index 261c1bb64..0511c96e2 100644 --- a/routes/auth.php +++ b/routes/auth.php @@ -9,14 +9,19 @@ | */ Route::group(['middleware' => 'guest'], function () { - // Login specific routes - Route::get('/login', 'LoginController@showLoginForm')->name('auth.login'); + // These routes are defined so that we can continue to reference them programatically. + // They all route to the same controller function which passes off to Vuejs. + Route::get('/login', 'LoginController@index')->name('auth.login'); + Route::get('/password', 'LoginController@index')->name('auth.forgot-password'); + Route::get('/password/reset/{token}', 'LoginController@index')->name('auth.reset'); + + // Login endpoints. Route::post('/login', 'LoginController@login')->middleware('recaptcha'); Route::post('/login/checkpoint', 'LoginCheckpointController')->name('auth.login-checkpoint'); // Forgot password route. A post to this endpoint will trigger an // email to be sent containing a reset token. - Route::post('/password', 'ForgotPasswordController@sendResetLinkEmail')->name('auth.forgot-password')->middleware('recaptcha'); + Route::post('/password', 'ForgotPasswordController@sendResetLinkEmail')->middleware('recaptcha'); // Password reset routes. This endpoint is hit after going through // the forgot password routes to acquire a token (or after an account