Finalize login page!

This commit is contained in:
Dane Everitt 2018-04-08 15:46:32 -05:00
parent d63624f607
commit 6d970a4cc3
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
10 changed files with 40 additions and 16 deletions

View file

@ -4,10 +4,23 @@ namespace Pterodactyl\Http\Controllers\Auth;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
use Illuminate\Contracts\View\View;
use Pterodactyl\Exceptions\Repository\RecordNotFoundException; use Pterodactyl\Exceptions\Repository\RecordNotFoundException;
class LoginController extends AbstractLoginController 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. * Handle a login request to the application.
* *

View file

@ -7,6 +7,7 @@ use Cache;
use Pterodactyl\Models\User; use Pterodactyl\Models\User;
use Pterodactyl\Models\Server; use Pterodactyl\Models\Server;
use Pterodactyl\Models\Subuser; use Pterodactyl\Models\Subuser;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Schema; use Illuminate\Support\Facades\Schema;
use Igaster\LaravelTheme\Facades\Theme; use Igaster\LaravelTheme\Facades\Theme;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
@ -21,6 +22,7 @@ class AppServiceProvider extends ServiceProvider
*/ */
public function boot() public function boot()
{ {
Blade::doubleEncode();
Schema::defaultStringLength(191); Schema::defaultStringLength(191);
User::observe(UserObserver::class); User::observe(UserObserver::class);

View file

@ -43,15 +43,16 @@ Vue.i18n.add('en', Locales.en);
Vue.i18n.set('en'); Vue.i18n.set('en');
const router = new VueRouter({ const router = new VueRouter({
mode: 'history',
routes: [ routes: [
{ {
name: 'login', name: 'login',
path: '/', path: '/auth/login',
component: Login, component: Login,
}, },
{ {
name: 'forgot-password', name: 'forgot-password',
path: '/forgot-password', path: '/auth/password',
component: Login, component: Login,
}, },
{ {
@ -61,7 +62,7 @@ const router = new VueRouter({
}, },
{ {
name: 'reset-password', name: 'reset-password',
path: '/reset-password/:token', path: '/auth/password/reset/:token',
component: ResetPassword, component: ResetPassword,
props: function (route) { props: function (route) {
return { return {

View file

@ -31,7 +31,9 @@
</button> </button>
</div> </div>
<div class="pt-6 text-center"> <div class="pt-6 text-center">
<router-link to="/" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"> <router-link class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"
:to="{ name: 'login' }"
>
{{ $t('auth.go_to_login') }} {{ $t('auth.go_to_login') }}
</router-link> </router-link>
</div> </div>

View file

@ -50,7 +50,9 @@
</button> </button>
</div> </div>
<div class="pt-6 text-center"> <div class="pt-6 text-center">
<router-link to="/" class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"> <router-link class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"
:to="{ name: 'login' }"
>
{{ $t('auth.go_to_login') }} {{ $t('auth.go_to_login') }}
</router-link> </router-link>
</div> </div>

View file

@ -18,7 +18,8 @@
</div> </div>
<div class="pt-6 text-center"> <div class="pt-6 text-center">
<router-link class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark" <router-link class="text-xs text-grey tracking-wide no-underline uppercase hover:text-grey-dark"
:to="{ name: 'login' }"> :to="{ name: 'login' }"
>
Back to Login Back to Login
</router-link> </router-link>
</div> </div>

View file

@ -84,4 +84,7 @@ return [
'sat' => 'Saturday', 'sat' => 'Saturday',
], ],
'last_used' => 'Last Used', 'last_used' => 'Last Used',
// Copyright Line
'copyright' => '&copy; 2015 - :year Pterodactyl Software',
]; ];

View file

@ -1,5 +0,0 @@
@extends('templates/auth.core')
@section('title')
Login
@endsection

View file

@ -1,6 +1,6 @@
<html> <html>
<head> <head>
<title>{{ config('app.name', 'Pterodactyl') }} - @yield('title')</title> <title>{{ config('app.name', 'Pterodactyl') }}</title>
@section('meta') @section('meta')
<meta charset="utf-8"> <meta charset="utf-8">
@ -23,7 +23,7 @@
</div> </div>
<router-view></router-view> <router-view></router-view>
<p class="text-center text-grey text-xs"> <p class="text-center text-grey text-xs">
&copy; 2015 - {{ date('Y') }} Pterodactyl Software {{ trans('strings.copyright', ['year' => date('Y')]) }}
</p> </p>
</div> </div>
</div> </div>

View file

@ -9,14 +9,19 @@
| |
*/ */
Route::group(['middleware' => 'guest'], function () { Route::group(['middleware' => 'guest'], function () {
// Login specific routes // These routes are defined so that we can continue to reference them programatically.
Route::get('/login', 'LoginController@showLoginForm')->name('auth.login'); // 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', 'LoginController@login')->middleware('recaptcha');
Route::post('/login/checkpoint', 'LoginCheckpointController')->name('auth.login-checkpoint'); Route::post('/login/checkpoint', 'LoginCheckpointController')->name('auth.login-checkpoint');
// Forgot password route. A post to this endpoint will trigger an // Forgot password route. A post to this endpoint will trigger an
// email to be sent containing a reset token. // 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 // Password reset routes. This endpoint is hit after going through
// the forgot password routes to acquire a token (or after an account // the forgot password routes to acquire a token (or after an account