diff --git a/app/Composers/AppComposer.php b/app/Composers/AppComposer.php index c136124ce..5c0c2b7be 100644 --- a/app/Composers/AppComposer.php +++ b/app/Composers/AppComposer.php @@ -85,5 +85,6 @@ class AppComposer $view->withSiteTitle($this->config->get('setting.app_name')); $view->withFontSubset($this->config->get('langs.'.$this->config->get('app.locale').'.subset', 'latin')); $view->withOnlyDisruptedDays($this->config->get('setting.only_disrupted_days')); + $view->withDashboardLink($this->config->get('setting.dashboard_login_link')); } } diff --git a/app/Http/Controllers/AuthController.php b/app/Http/Controllers/AuthController.php index 2c9e06897..5593310a5 100644 --- a/app/Http/Controllers/AuthController.php +++ b/app/Http/Controllers/AuthController.php @@ -19,7 +19,6 @@ use GrahamCampbell\Binput\Facades\Binput; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Redirect; -use Illuminate\Support\Facades\Request; use Illuminate\Support\Facades\Session; use Illuminate\Support\Facades\View; use PragmaRX\Google2FA\Vendor\Laravel\Facade as Google2FA; @@ -44,26 +43,25 @@ class AuthController extends Controller */ public function postLogin() { - $loginData = Binput::only(['username', 'password']); + $loginData = Binput::only(['username', 'password', 'remember_me']); // Login with username or email. $loginKey = filter_var($loginData['username'], FILTER_VALIDATE_EMAIL) ? 'email' : 'username'; $loginData[$loginKey] = array_pull($loginData, 'username'); + $rememberUser = array_pull($loginData, 'remember_me') === '1'; + // Validate login credentials. if (Auth::validate($loginData)) { - // Log the user in for one request. Auth::once($loginData); - // Do we have Two Factor Auth enabled? + if (Auth::user()->hasTwoFactor) { - // Temporarily store the user. Session::put('2fa_id', Auth::user()->id); return Redirect::route('auth.two-factor'); } - // We probably want to add support for "Remember me" here. - Auth::attempt($loginData); + Auth::attempt($loginData, $rememberUser); event(new UserLoggedInEvent(Auth::user())); diff --git a/app/Http/Controllers/SetupController.php b/app/Http/Controllers/SetupController.php index 5c27b0c13..b2aa4f8fe 100644 --- a/app/Http/Controllers/SetupController.php +++ b/app/Http/Controllers/SetupController.php @@ -64,6 +64,20 @@ class SetupController extends Controller 'log' => 'Log (Testing)', ]; + /** + * Array of queue drivers. + * + * @var string[] + */ + protected $queueDrivers = [ + 'null' => 'None', + 'sync' => 'Synchronous', + 'database' => 'Database', + 'beanstalkd' => 'Beanstalk', + 'sqs' => 'Amazon SQS', + 'redis' => 'Redis', + ]; + /** * Array of step1 rules. * @@ -95,6 +109,7 @@ class SetupController extends Controller $this->rulesStep1 = [ 'env.cache_driver' => 'required|in:'.implode(',', array_keys($this->cacheDrivers)), 'env.session_driver' => 'required|in:'.implode(',', array_keys($this->cacheDrivers)), + 'env.queue_driver' => 'required|in:'.implode(',', array_keys($this->queueDrivers)), 'env.mail_driver' => 'required|in:'.implode(',', array_keys($this->mailDrivers)), ]; @@ -132,12 +147,38 @@ class SetupController extends Controller } } + // Since .env may already be configured, we should show that data! + $cacheConfig = [ + 'driver' => Config::get('cache.default'), + ]; + + $sessionConfig = [ + 'driver' => Config::get('session.driver'), + ]; + + $queueConfig = [ + 'driver' => Config::get('queue.default'), + ]; + + $mailConfig = [ + 'driver' => Config::get('mail.driver'), + 'host' => Config::get('mail.host'), + 'from' => Config::get('mail.from'), + 'username' => Config::get('mail.username'), + 'password' => Config::get('mail.password'), + ]; + return View::make('setup.index') ->withPageTitle(trans('setup.setup')) ->withCacheDrivers($this->cacheDrivers) + ->withQueueDrivers($this->queueDrivers) ->withMailDrivers($this->mailDrivers) ->withUserLanguage($userLanguage) - ->withAppUrl(Request::root()); + ->withAppUrl(Request::root()) + ->withCacheConfig($cacheConfig) + ->withSessionConfig($sessionConfig) + ->withQueueConfig($queueConfig) + ->withMailConfig($mailConfig); } /** diff --git a/app/Http/Routes/FeedRoutes.php b/app/Http/Routes/FeedRoutes.php index f5d1f3ee6..cad095169 100644 --- a/app/Http/Routes/FeedRoutes.php +++ b/app/Http/Routes/FeedRoutes.php @@ -29,13 +29,13 @@ class FeedRoutes */ public function map(Registrar $router) { - $router->group(['middleware' => ['web', 'ready']], function (Registrar $router) { + $router->group(['middleware' => ['web', 'ready'], 'as' => 'feed.'], function (Registrar $router) { $router->get('/atom/{component_group?}', [ - 'as' => 'feed.atom', + 'as' => 'atom', 'uses' => 'FeedController@atomAction', ]); $router->get('/rss/{component_group?}', [ - 'as' => 'feed.rss', + 'as' => 'rss', 'uses' => 'FeedController@rssAction', ]); }); diff --git a/resources/lang/en/forms.php b/resources/lang/en/forms.php index 6064a1a8d..cc85c86ae 100644 --- a/resources/lang/en/forms.php +++ b/resources/lang/en/forms.php @@ -22,6 +22,7 @@ return [ 'site_locale' => 'Select your language', 'enable_google2fa' => 'Enable Google Two Factor Authentication', 'cache_driver' => 'Cache Driver', + 'queue_driver' => 'Queue Driver', 'session_driver' => 'Session Driver', 'mail_driver' => 'Mail Driver', 'mail_host' => 'Mail Host', @@ -40,6 +41,7 @@ return [ 'invalid-token' => 'Invalid token', 'cookies' => 'You must enable cookies to login.', 'rate-limit' => 'Rate limit exceeded.', + 'remember_me' => 'Remember me', ], // Incidents form fields diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php index a4537f53b..28d2d60e7 100644 --- a/resources/views/auth/login.blade.php +++ b/resources/views/auth/login.blade.php @@ -27,6 +27,12 @@ +
+ + +
diff --git a/resources/views/auth/two-factor-auth.blade.php b/resources/views/auth/two-factor-auth.blade.php index 048fa9a7c..d618fc967 100644 --- a/resources/views/auth/two-factor-auth.blade.php +++ b/resources/views/auth/two-factor-auth.blade.php @@ -7,17 +7,7 @@

@@ -28,7 +18,7 @@

{{ trans('dashboard.login.two-factor') }}


-
+
diff --git a/resources/views/dashboard/components/edit.blade.php b/resources/views/dashboard/components/edit.blade.php index 429a35e90..6bcd63d83 100644 --- a/resources/views/dashboard/components/edit.blade.php +++ b/resources/views/dashboard/components/edit.blade.php @@ -66,7 +66,7 @@
- +
diff --git a/resources/views/dashboard/incidents/add.blade.php b/resources/views/dashboard/incidents/add.blade.php index 4bf09009d..0b2c393fb 100644 --- a/resources/views/dashboard/incidents/add.blade.php +++ b/resources/views/dashboard/incidents/add.blade.php @@ -65,8 +65,8 @@
@if(!$components_in_groups->isEmpty() || !$components_out_groups->isEmpty()) diff --git a/resources/views/dashboard/incidents/update.blade.php b/resources/views/dashboard/incidents/update.blade.php index b1e29028a..0d4f1c18c 100644 --- a/resources/views/dashboard/incidents/update.blade.php +++ b/resources/views/dashboard/incidents/update.blade.php @@ -49,7 +49,7 @@
- id }}> +
diff --git a/resources/views/dashboard/partials/sidebar.blade.php b/resources/views/dashboard/partials/sidebar.blade.php index 097038ac5..ee19cd25a 100644 --- a/resources/views/dashboard/partials/sidebar.blade.php +++ b/resources/views/dashboard/partials/sidebar.blade.php @@ -1,10 +1,10 @@