mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Improving initial setup
This commit is contained in:
parent
67dff394b4
commit
4a170ffb3e
@ -13,6 +13,7 @@ use Session;
|
|||||||
use Cookie;
|
use Cookie;
|
||||||
use Response;
|
use Response;
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
|
use App\Models\Account;
|
||||||
use App\Ninja\Mailers\Mailer;
|
use App\Ninja\Mailers\Mailer;
|
||||||
use App\Ninja\Repositories\AccountRepository;
|
use App\Ninja\Repositories\AccountRepository;
|
||||||
use Redirect;
|
use Redirect;
|
||||||
@ -32,18 +33,12 @@ class AppController extends BaseController
|
|||||||
|
|
||||||
public function showSetup()
|
public function showSetup()
|
||||||
{
|
{
|
||||||
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
|
if (Utils::isNinja() || (Utils::isDatabaseSetup() && Account::count() > 0)) {
|
||||||
return Redirect::to('/');
|
return Redirect::to('/');
|
||||||
}
|
}
|
||||||
|
|
||||||
$view = View::make('setup');
|
$view = View::make('setup');
|
||||||
|
|
||||||
/*
|
|
||||||
$cookie = Cookie::forget('ninja_session', '/', 'www.ninja.dev');
|
|
||||||
Cookie::queue($cookie);
|
|
||||||
return Response::make($view)->withCookie($cookie);
|
|
||||||
*/
|
|
||||||
|
|
||||||
return Response::make($view);
|
return Response::make($view);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,10 +27,8 @@ class HomeController extends BaseController
|
|||||||
{
|
{
|
||||||
Session::reflash();
|
Session::reflash();
|
||||||
|
|
||||||
if (!Utils::isDatabaseSetup()) {
|
if (!Utils::isNinja() && (!Utils::isDatabaseSetup() || Account::count() == 0)) {
|
||||||
return Redirect::to('/setup');
|
return Redirect::to('/setup');
|
||||||
} elseif (Account::count() == 0) {
|
|
||||||
return Redirect::to('/invoice_now');
|
|
||||||
} elseif (Auth::check()) {
|
} elseif (Auth::check()) {
|
||||||
return Redirect::to('/dashboard');
|
return Redirect::to('/dashboard');
|
||||||
} else {
|
} else {
|
||||||
|
@ -15,11 +15,7 @@ class Mailer
|
|||||||
|
|
||||||
Mail::send($views, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $data) {
|
Mail::send($views, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $data) {
|
||||||
$replyEmail = $fromEmail;
|
$replyEmail = $fromEmail;
|
||||||
|
$fromEmail = NINJA_FROM_EMAIL;
|
||||||
// http://stackoverflow.com/questions/2421234/gmail-appearing-to-ignore-reply-to
|
|
||||||
if (Utils::isNinja() && $toEmail != CONTACT_EMAIL) {
|
|
||||||
$fromEmail = NINJA_FROM_EMAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(isset($data['invoice_id'])) {
|
if(isset($data['invoice_id'])) {
|
||||||
$invoice = Invoice::with('account')->where('id', '=', $data['invoice_id'])->get()->first();
|
$invoice = Invoice::with('account')->where('id', '=', $data['invoice_id'])->get()->first();
|
||||||
|
@ -704,4 +704,6 @@ return array(
|
|||||||
'login' => 'Login',
|
'login' => 'Login',
|
||||||
'or' => 'or',
|
'or' => 'or',
|
||||||
|
|
||||||
|
'email_error' => 'There was a problem sending the email',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
@ -6,10 +6,11 @@
|
|||||||
<meta name="csrf-token" content="<?= csrf_token() ?>">
|
<meta name="csrf-token" content="<?= csrf_token() ?>">
|
||||||
<script src="{{ asset('js/built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
|
<script src="{{ asset('js/built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
|
||||||
<link href="{{ asset('css/built.public.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
<link href="{{ asset('css/built.public.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
||||||
|
<link href="{{ asset('css/built.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
body {
|
body {
|
||||||
background-color: #f8f8f8;
|
background-color: #FEFEFE;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
<h3 class="panel-title">Application Settings</h3>
|
<h3 class="panel-title">Application Settings</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{!! Former::text('app[url]')->label('URL')->value(Request::root()) !!}
|
{!! Former::text('app[url]')->label('URL')->value(isset($_ENV['APP_URL']) ? $_ENV['APP_URL'] : Request::root()) !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -73,12 +74,17 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
<h3 class="panel-title">Database Connection</h3>
|
<h3 class="panel-title">Database Connection</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
{!! Former::select('database[default]')->label('Driver')->options(['mysql' => 'MySQL', 'pgsql' => 'PostgreSQL', 'sqlite' => 'SQLite']) !!}
|
{!! Former::select('database[default]')->label('Driver')->options(['mysql' => 'MySQL', 'pgsql' => 'PostgreSQL', 'sqlite' => 'SQLite'])
|
||||||
{!! Former::text('database[type][host]')->label('Host')->value('localhost') !!}
|
->value(isset($_ENV['DB_TYPE']) ? $_ENV['DB_TYPE'] : 'mysql') !!}
|
||||||
{!! Former::text('database[type][database]')->label('Database')->value('ninja') !!}
|
{!! Former::text('database[type][host]')->label('Host')->value('localhost')
|
||||||
{!! Former::text('database[type][username]')->label('Username')->value('ninja') !!}
|
->value(isset($_ENV['DB_HOST']) ? $_ENV['DB_HOST'] : '') !!}
|
||||||
{!! Former::password('database[type][password]')->label('Password')->value('ninja') !!}
|
{!! Former::text('database[type][database]')->label('Database')->value('ninja')
|
||||||
{!! Former::actions( Button::normal('Test connection')->withAttributes(['onclick' => 'testDatabase()']), ' <span id="dbTestResult"/>' ) !!}
|
->value(isset($_ENV['DB_DATABASE']) ? $_ENV['DB_DATABASE'] : '') !!}
|
||||||
|
{!! Former::text('database[type][username]')->label('Username')->value('ninja')
|
||||||
|
->value(isset($_ENV['DB_USERNAME']) ? $_ENV['DB_USERNAME'] : '') !!}
|
||||||
|
{!! Former::password('database[type][password]')->label('Password')->value('ninja')
|
||||||
|
->value(isset($_ENV['DB_PASSWORD']) ? $_ENV['DB_PASSWORD'] : '') !!}
|
||||||
|
{!! Former::actions( Button::primary('Test connection')->small()->withAttributes(['onclick' => 'testDatabase()']), ' <span id="dbTestResult"/>' ) !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -95,7 +101,7 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
{!! Former::text('mail[from][name]')->label('From Name') !!}
|
{!! Former::text('mail[from][name]')->label('From Name') !!}
|
||||||
{!! Former::text('mail[username]')->label('Email') !!}
|
{!! Former::text('mail[username]')->label('Email') !!}
|
||||||
{!! Former::password('mail[password]')->label('Password') !!}
|
{!! Former::password('mail[password]')->label('Password') !!}
|
||||||
{!! Former::actions( Button::normal('Send test email')->withAttributes(['onclick' => 'testMail()']), ' <span id="mailTestResult"/>' ) !!}
|
{!! Former::actions( Button::primary('Send test email')->small()->withAttributes(['onclick' => 'testMail()']), ' <span id="mailTestResult"/>' ) !!}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -113,7 +119,7 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.NINJA_APP_URL.'/terms" target="_blank">'.trans('texts.terms_of_service').'</a>'])) !!}
|
{!! Former::checkbox('terms_checkbox')->label(' ')->text(trans('texts.agree_to_terms', ['terms' => '<a href="'.NINJA_APP_URL.'/terms" target="_blank">'.trans('texts.terms_of_service').'</a>'])) !!}
|
||||||
{!! Former::actions( Button::primary('Submit')->submit() ) !!}
|
{!! Former::actions( Button::primary('Submit')->large()->submit() ) !!}
|
||||||
{!! Former::close() !!}
|
{!! Former::close() !!}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user