1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

Improving initial setup

This commit is contained in:
Hillel Coren 2015-06-20 20:40:50 +03:00
parent 67dff394b4
commit 4a170ffb3e
5 changed files with 22 additions and 25 deletions

View File

@ -13,6 +13,7 @@ use Session;
use Cookie;
use Response;
use App\Models\User;
use App\Models\Account;
use App\Ninja\Mailers\Mailer;
use App\Ninja\Repositories\AccountRepository;
use Redirect;
@ -32,18 +33,12 @@ class AppController extends BaseController
public function showSetup()
{
if (Utils::isNinja() || Utils::isDatabaseSetup()) {
if (Utils::isNinja() || (Utils::isDatabaseSetup() && Account::count() > 0)) {
return Redirect::to('/');
}
$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);
}

View File

@ -27,10 +27,8 @@ class HomeController extends BaseController
{
Session::reflash();
if (!Utils::isDatabaseSetup()) {
if (!Utils::isNinja() && (!Utils::isDatabaseSetup() || Account::count() == 0)) {
return Redirect::to('/setup');
} elseif (Account::count() == 0) {
return Redirect::to('/invoice_now');
} elseif (Auth::check()) {
return Redirect::to('/dashboard');
} else {

View File

@ -15,11 +15,7 @@ class Mailer
Mail::send($views, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $data) {
$replyEmail = $fromEmail;
// 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'])) {
$invoice = Invoice::with('account')->where('id', '=', $data['invoice_id'])->get()->first();

View File

@ -704,4 +704,6 @@ return array(
'login' => 'Login',
'or' => 'or',
'email_error' => 'There was a problem sending the email',
);

View File

@ -6,10 +6,11 @@
<meta name="csrf-token" content="<?= csrf_token() ?>">
<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.css') }}?no_cache={{ NINJA_VERSION }}" rel="stylesheet" type="text/css"/>
<style type="text/css">
body {
background-color: #f8f8f8;
background-color: #FEFEFE;
}
</style>
@ -64,7 +65,7 @@ FLUSH PRIVILEGES;</pre>
<h3 class="panel-title">Application Settings</h3>
</div>
<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>
@ -73,12 +74,17 @@ FLUSH PRIVILEGES;</pre>
<h3 class="panel-title">Database Connection</h3>
</div>
<div class="panel-body">
{!! Former::select('database[default]')->label('Driver')->options(['mysql' => 'MySQL', 'pgsql' => 'PostgreSQL', 'sqlite' => 'SQLite']) !!}
{!! Former::text('database[type][host]')->label('Host')->value('localhost') !!}
{!! Former::text('database[type][database]')->label('Database')->value('ninja') !!}
{!! Former::text('database[type][username]')->label('Username')->value('ninja') !!}
{!! Former::password('database[type][password]')->label('Password')->value('ninja') !!}
{!! Former::actions( Button::normal('Test connection')->withAttributes(['onclick' => 'testDatabase()']), '&nbsp;&nbsp;<span id="dbTestResult"/>' ) !!}
{!! Former::select('database[default]')->label('Driver')->options(['mysql' => 'MySQL', 'pgsql' => 'PostgreSQL', 'sqlite' => 'SQLite'])
->value(isset($_ENV['DB_TYPE']) ? $_ENV['DB_TYPE'] : 'mysql') !!}
{!! Former::text('database[type][host]')->label('Host')->value('localhost')
->value(isset($_ENV['DB_HOST']) ? $_ENV['DB_HOST'] : '') !!}
{!! Former::text('database[type][database]')->label('Database')->value('ninja')
->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()']), '&nbsp;&nbsp;<span id="dbTestResult"/>' ) !!}
</div>
</div>
@ -95,7 +101,7 @@ FLUSH PRIVILEGES;</pre>
{!! Former::text('mail[from][name]')->label('From Name') !!}
{!! Former::text('mail[username]')->label('Email') !!}
{!! Former::password('mail[password]')->label('Password') !!}
{!! Former::actions( Button::normal('Send test email')->withAttributes(['onclick' => 'testMail()']), '&nbsp;&nbsp;<span id="mailTestResult"/>' ) !!}
{!! Former::actions( Button::primary('Send test email')->small()->withAttributes(['onclick' => 'testMail()']), '&nbsp;&nbsp;<span id="mailTestResult"/>' ) !!}
</div>
</div>
@ -113,7 +119,7 @@ FLUSH PRIVILEGES;</pre>
</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::actions( Button::primary('Submit')->submit() ) !!}
{!! Former::actions( Button::primary('Submit')->large()->submit() ) !!}
{!! Former::close() !!}
</div>