All routes now redirect to the signup page if no account has been created

This commit is contained in:
Dave Earley 2016-05-28 23:19:02 +01:00
parent 14991f7a6f
commit 74ad9351ff
3 changed files with 13 additions and 2 deletions

View File

@ -3,6 +3,7 @@
namespace app\Http\Middleware;
use App\Attendize\Utils;
use App\Models\Account;
use Closure;
use Redirect;
use Request;
@ -19,10 +20,20 @@ class CheckInstalled
*/
public function handle($request, Closure $next)
{
/*
* Check if the 'installed' file has been created
*/
if (!file_exists(base_path('installed')) && !Utils::isAttendize()) {
return Redirect::to('install');
}
/*
* Redirect user to signup page if there are no accounts
*/
if(Account::count() === 0 && !$request->is('signup*')) {
return redirect()->to('signup');
}
$response = $next($request);
return $response;

View File

@ -19,7 +19,7 @@ class FirstRunMiddleware
*/
public function handle($request, Closure $next)
{
/*
* If there are no organisers then redirect the user to create one
* else - if there's only one organiser bring the user straight there.

View File

@ -21,7 +21,7 @@ class GeneralChecks
if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/(?i)msie [2-8]/', $_SERVER['HTTP_USER_AGENT'])) {
Session::flash('message', 'Please update your browser. This application requires a modern browser.');
}
$response = $next($request);
return $response;