2015-03-20 18:30:45 -06:00
|
|
|
<?php
|
|
|
|
|
2015-04-19 08:52:39 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Cachet.
|
|
|
|
*
|
2015-07-06 17:37:01 +01:00
|
|
|
* (c) Alt Three Services Limited
|
2015-04-19 08:52:39 +01:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2015-03-20 18:30:45 -06:00
|
|
|
namespace CachetHQ\Cachet\Http\Routes;
|
|
|
|
|
|
|
|
use Illuminate\Contracts\Routing\Registrar;
|
|
|
|
|
2015-08-07 14:52:44 +01:00
|
|
|
/**
|
|
|
|
* This is the auth routes class.
|
|
|
|
*
|
|
|
|
* @author James Brooks <james@alt-three.com>
|
|
|
|
*/
|
2015-03-20 18:30:45 -06:00
|
|
|
class AuthRoutes
|
|
|
|
{
|
2016-10-19 12:28:54 +01:00
|
|
|
/**
|
|
|
|
* Defines if these routes are for the browser.
|
|
|
|
*
|
|
|
|
* @var bool
|
|
|
|
*/
|
|
|
|
public static $browser = true;
|
|
|
|
|
2015-03-20 18:30:45 -06:00
|
|
|
/**
|
|
|
|
* Define the auth routes.
|
|
|
|
*
|
|
|
|
* @param \Illuminate\Contracts\Routing\Registrar $router
|
2015-12-24 17:30:59 +00:00
|
|
|
*
|
|
|
|
* @return void
|
2015-03-20 18:30:45 -06:00
|
|
|
*/
|
|
|
|
public function map(Registrar $router)
|
|
|
|
{
|
2016-10-12 21:31:07 +01:00
|
|
|
$router->group([
|
2016-10-19 12:28:54 +01:00
|
|
|
'middleware' => ['ready'],
|
2016-10-12 21:31:07 +01:00
|
|
|
'prefix' => 'auth',
|
|
|
|
], function (Registrar $router) {
|
2015-08-07 14:52:44 +01:00
|
|
|
$router->get('login', [
|
2016-10-12 21:31:07 +01:00
|
|
|
'as' => 'get:auth.login',
|
2015-08-07 14:52:44 +01:00
|
|
|
'middleware' => 'guest',
|
|
|
|
'uses' => 'AuthController@showLogin',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('login', [
|
2016-10-12 21:31:07 +01:00
|
|
|
'as' => 'post:auth.login',
|
2016-02-25 21:26:46 +00:00
|
|
|
'middleware' => ['guest', 'throttle:10,10'],
|
2015-08-07 14:52:44 +01:00
|
|
|
'uses' => 'AuthController@postLogin',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->get('2fa', [
|
2016-10-12 21:31:07 +01:00
|
|
|
'as' => 'get:auth.two-factor',
|
2015-08-07 14:52:44 +01:00
|
|
|
'uses' => 'AuthController@showTwoFactorAuth',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->post('2fa', [
|
2016-10-12 21:31:07 +01:00
|
|
|
'as' => 'post:auth.two-factor',
|
2016-02-25 21:26:46 +00:00
|
|
|
'middleware' => ['throttle:10,10'],
|
2015-08-07 14:52:44 +01:00
|
|
|
'uses' => 'AuthController@postTwoFactor',
|
|
|
|
]);
|
|
|
|
|
|
|
|
$router->get('logout', [
|
2016-10-12 21:31:07 +01:00
|
|
|
'as' => 'get:auth.logout',
|
2015-08-07 14:52:44 +01:00
|
|
|
'uses' => 'AuthController@logoutAction',
|
|
|
|
'middleware' => 'auth',
|
|
|
|
]);
|
2015-03-20 18:30:45 -06:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|