Migrate to Laravel 5.3
This commit is contained in:
parent
579aee7a12
commit
577fae0540
33 changed files with 424 additions and 297 deletions
32
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
32
app/Http/Controllers/Auth/ForgotPasswordController.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\SendsPasswordResetEmails;
|
||||
|
||||
class ForgotPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Password Reset Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller is responsible for handling password reset emails and
|
||||
| includes a trait which assists in sending these notifications from
|
||||
| your application to your users. Feel free to explore this trait.
|
||||
|
|
||||
*/
|
||||
|
||||
use SendsPasswordResetEmails;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
39
app/Http/Controllers/Auth/LoginController.php
Normal file
39
app/Http/Controllers/Auth/LoginController.php
Normal file
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesUsers;
|
||||
|
||||
class LoginController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Login Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles authenticating users for the application and
|
||||
| redirecting them to your home screen. The controller uses a trait
|
||||
| to conveniently provide its functionality to your applications.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login / registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('guest', ['except' => 'logout']);
|
||||
}
|
||||
}
|
|
@ -5,39 +5,38 @@ namespace App\Http\Controllers\Auth;
|
|||
use App\User;
|
||||
use Validator;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ThrottlesLogins;
|
||||
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
|
||||
use Illuminate\Foundation\Auth\RegistersUsers;
|
||||
|
||||
class AuthController extends Controller
|
||||
class RegisterController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Registration & Login Controller
|
||||
| Register Controller
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This controller handles the registration of new users, as well as the
|
||||
| authentication of existing users. By default, this controller uses
|
||||
| a simple trait to add these behaviors. Why don't you explore it?
|
||||
| This controller handles the registration of new users as well as their
|
||||
| validation and creation. By default this controller uses a trait to
|
||||
| provide this functionality without requiring any additional code.
|
||||
|
|
||||
*/
|
||||
|
||||
use AuthenticatesAndRegistersUsers, ThrottlesLogins;
|
||||
use RegistersUsers;
|
||||
|
||||
/**
|
||||
* Where to redirect users after login / registration.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $redirectTo = '/';
|
||||
protected $redirectTo = '/home';
|
||||
|
||||
/**
|
||||
* Create a new authentication controller instance.
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
|
||||
$this->middleware('guest');
|
||||
}
|
||||
|
||||
/**
|
|
@ -5,7 +5,7 @@ namespace App\Http\Controllers\Auth;
|
|||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Foundation\Auth\ResetsPasswords;
|
||||
|
||||
class PasswordController extends Controller
|
||||
class ResetPasswordController extends Controller
|
||||
{
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
|
@ -21,12 +21,12 @@ class PasswordController extends Controller
|
|||
use ResetsPasswords;
|
||||
|
||||
/**
|
||||
* Create a new password controller instance.
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware($this->guestMiddleware());
|
||||
$this->middleware('guest');
|
||||
}
|
||||
}
|
|
@ -6,9 +6,8 @@ use Illuminate\Foundation\Bus\DispatchesJobs;
|
|||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesResources;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, AuthorizesResources, DispatchesJobs, ValidatesRequests;
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
|
|
|
@ -29,11 +29,13 @@ class Kernel extends HttpKernel
|
|||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
\Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||
\App\Http\Middleware\LinkHeadersMiddleware::class,
|
||||
],
|
||||
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
'bindings',
|
||||
],
|
||||
];
|
||||
|
||||
|
@ -47,7 +49,7 @@ class Kernel extends HttpKernel
|
|||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class,
|
||||
'can' => \Illuminate\Foundation\Http\Middleware\Authorize::class,
|
||||
'can' => \Illuminate\Auth\Middleware\Authorize::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'myauth' => \App\Http\Middleware\MyAuthMiddleware::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class Authenticate
|
||||
{
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $guard = null)
|
||||
{
|
||||
if (Auth::guard($guard)->guest()) {
|
||||
if ($request->ajax() || $request->wantsJson()) {
|
||||
return response('Unauthorized.', 401);
|
||||
} else {
|
||||
return redirect()->guest('login');
|
||||
}
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
abstract class Request extends FormRequest
|
||||
{
|
||||
//
|
||||
}
|
|
@ -1,150 +0,0 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Application Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register all of the routes for an application.
|
||||
| It's a breeze. Simply tell Laravel the URIs it should respond to
|
||||
| and give it the controller to call when that URI is requested.
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group(['domain' => config('url.longurl')], function () {
|
||||
//Static homepage
|
||||
Route::get('/', function () {
|
||||
return view('homepage');
|
||||
});
|
||||
|
||||
//Static project page
|
||||
Route::get('projects', function () {
|
||||
return view('projects');
|
||||
});
|
||||
|
||||
//The login routes to get authe'd for admin
|
||||
Route::get('login', ['as' => 'login', function () {
|
||||
return view('login');
|
||||
}]);
|
||||
Route::post('login', 'AuthController@login');
|
||||
|
||||
//Admin pages grouped for filter
|
||||
Route::group(['middleware' => 'myauth'], function () {
|
||||
Route::get('admin', 'AdminController@showWelcome');
|
||||
|
||||
//Articles
|
||||
Route::get('admin/blog/new', 'ArticlesAdminController@newArticle');
|
||||
Route::get('admin/blog/edit', 'ArticlesAdminController@listArticles');
|
||||
Route::get('admin/blog/edit/{id}', 'ArticlesAdminController@editArticle');
|
||||
Route::get('admin/blog/delete/{id}', 'ArticlesAdminController@deleteArticle');
|
||||
Route::post('admin/blog/new', 'ArticlesAdminController@postNewArticle');
|
||||
Route::post('admin/blog/edit/{id}', 'ArticlesAdminController@postEditArticle');
|
||||
Route::post('admin/blog/delete/{id}', 'ArticlesAdminController@postDeleteArticle');
|
||||
|
||||
//Notes
|
||||
Route::get('admin/note/new', 'NotesAdminController@newNotePage');
|
||||
Route::get('admin/note/edit', 'NotesAdminController@listNotesPage');
|
||||
Route::get('admin/note/edit/{id}', 'NotesAdminController@editNotePage');
|
||||
Route::post('admin/note/new', 'NotesAdminController@createNote');
|
||||
Route::post('admin/note/edit/{id}', 'NotesAdminController@editNote');
|
||||
|
||||
//Tokens
|
||||
Route::get('admin/tokens', 'TokensController@showTokens');
|
||||
Route::get('admin/tokens/delete/{id}', 'TokensController@deleteToken');
|
||||
Route::post('admin/tokens/delete/{id}', 'TokensController@postDeleteToken');
|
||||
|
||||
//Micropub Clients
|
||||
Route::get('admin/clients', 'ClientsAdminController@listClients');
|
||||
Route::get('admin/clients/new', 'ClientsAdminController@newClient');
|
||||
Route::get('admin/clients/edit/{id}', 'ClientsAdminController@editClient');
|
||||
Route::post('admin/clients/new', 'ClientsAdminController@postNewClient');
|
||||
Route::post('admin/clients/edit/{id}', 'ClientsAdminController@postEditClient');
|
||||
|
||||
//Contacts
|
||||
Route::get('admin/contacts/new', 'ContactsAdminController@newContact');
|
||||
Route::get('admin/contacts/edit', 'ContactsAdminController@listContacts');
|
||||
Route::get('admin/contacts/edit/{id}', 'ContactsAdminController@editContact');
|
||||
Route::get('admin/contacts/edit/{id}/getavatar', 'ContactsAdminController@getAvatar');
|
||||
Route::get('admin/contacts/delete/{id}', 'ContactsAdminController@deleteContact');
|
||||
Route::post('admin/contacts/new', 'ContactsAdminController@postNewContact');
|
||||
Route::post('admin/contacts/edit/{id}', 'ContactsAdminController@postEditContact');
|
||||
Route::post('admin/contacts/delete/{id}', 'ContactsAdminController@postDeleteContact');
|
||||
|
||||
//Places
|
||||
Route::get('admin/places/new', 'PlacesAdminController@newPlacePage');
|
||||
Route::get('admin/places/edit', 'PlacesAdminController@listPlacesPage');
|
||||
Route::get('admin/places/edit/{id}', 'PlacesAdminController@editPlacePage');
|
||||
Route::post('admin/places/new', 'PlacesAdminController@createPlace');
|
||||
Route::post('admin/places/edit/{id}', 'PlacesAdminController@editPlace');
|
||||
});
|
||||
|
||||
//Blog pages using ArticlesController
|
||||
Route::get('blog/s/{id}', 'ArticlesController@onlyIdInURL');
|
||||
Route::get('blog/{year?}/{month?}', 'ArticlesController@showAllArticles');
|
||||
Route::get('blog/{year}/{month}/{slug}', 'ArticlesController@singleArticle');
|
||||
|
||||
//micropub new notes page
|
||||
//this needs to be first so `notes/new` doesn't match `notes/{id}`
|
||||
Route::get('notes/new', 'MicropubClientController@newNotePage');
|
||||
Route::post('notes/new', 'MicropubClientController@postNewNote');
|
||||
|
||||
//Notes pages using NotesController
|
||||
Route::get('notes', 'NotesController@showNotes');
|
||||
Route::get('note/{id}', 'NotesController@singleNoteRedirect');
|
||||
Route::get('notes/{id}', 'NotesController@singleNote');
|
||||
Route::get('notes/tagged/{tag}', 'NotesController@taggedNotes');
|
||||
|
||||
//indieauth
|
||||
Route::any('beginauth', 'IndieAuthController@beginauth');
|
||||
Route::get('indieauth', 'IndieAuthController@indieauth');
|
||||
Route::post('api/token', 'IndieAuthController@tokenEndpoint');
|
||||
Route::get('logout', 'IndieAuthController@indieauthLogout');
|
||||
|
||||
//micropub endoints
|
||||
Route::post('api/post', 'MicropubController@post');
|
||||
Route::get('api/post', 'MicropubController@getEndpoint');
|
||||
|
||||
//micropub refresh syndication targets
|
||||
Route::get('refresh-syndication-targets', 'MicropubClientController@refreshSyndicationTargets');
|
||||
|
||||
//webmention
|
||||
Route::get('webmention', function () {
|
||||
return view('webmention-endpoint');
|
||||
});
|
||||
Route::post('webmention', 'WebMentionsController@receive');
|
||||
|
||||
//Contacts
|
||||
Route::get('contacts', 'ContactsController@showAll');
|
||||
Route::get('contacts/{nick}', 'ContactsController@showSingle');
|
||||
|
||||
//Places
|
||||
Route::get('places', 'PlacesController@index');
|
||||
Route::get('places/{slug}', 'PlacesController@show');
|
||||
//Places micropub
|
||||
Route::get('places/near/{lat}/{lng}', 'MicropubClientController@nearbyPlaces');
|
||||
Route::post('places/new', 'MicropubClientController@postNewPlace');
|
||||
|
||||
Route::get('feed', 'ArticlesController@makeRSS');
|
||||
});
|
||||
|
||||
//Short URL
|
||||
Route::group(['domain' => config('url.shorturl')], function () {
|
||||
Route::get('/', 'ShortURLsController@baseURL');
|
||||
Route::get('@', 'ShortURLsController@twitter');
|
||||
Route::get('+', 'ShortURLsController@googlePlus');
|
||||
Route::get('α', 'ShortURLsController@appNet');
|
||||
|
||||
Route::get('{type}/{id}', 'ShortURLsController@expandType')->where(
|
||||
[
|
||||
'type' => '[bt]',
|
||||
'id' => '[0-9A-HJ-NP-Z_a-km-z]+',
|
||||
]
|
||||
);
|
||||
|
||||
Route::get('h/{id}', 'ShortURLsController@redirect');
|
||||
Route::get('{id}', 'ShortURLsController@oldRedirect')->where(
|
||||
[
|
||||
'id' => '[0-9A-HJ-NP-Z_a-km-z]{4}',
|
||||
]
|
||||
);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue