mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-23 20:00:33 -04:00
Working on self host setup page
This commit is contained in:
parent
e0aad0e248
commit
6b519f6833
@ -872,7 +872,14 @@ class AccountController extends \BaseController {
|
|||||||
$user->registered = true;
|
$user->registered = true;
|
||||||
$user->amend();
|
$user->amend();
|
||||||
|
|
||||||
$this->userMailer->sendConfirmation($user);
|
if (Utils::isNinja())
|
||||||
|
{
|
||||||
|
$this->userMailer->sendConfirmation($user);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//$this->accountRepo->registerUser($user);
|
||||||
|
}
|
||||||
|
|
||||||
$activities = Activity::scope()->get();
|
$activities = Activity::scope()->get();
|
||||||
foreach ($activities as $activity)
|
foreach ($activities as $activity)
|
||||||
|
@ -42,7 +42,7 @@ class AppController extends BaseController {
|
|||||||
$database = Input::get('database');
|
$database = Input::get('database');
|
||||||
$dbType = $database['default'];
|
$dbType = $database['default'];
|
||||||
$database[$dbType] = $database['type'];
|
$database[$dbType] = $database['type'];
|
||||||
unset($database['type']);
|
//unset($database['type']);
|
||||||
|
|
||||||
$mail = Input::get('mail');
|
$mail = Input::get('mail');
|
||||||
$email = $mail['username'];
|
$email = $mail['username'];
|
||||||
@ -64,6 +64,11 @@ class AppController extends BaseController {
|
|||||||
return Redirect::to('/setup')->withInput();
|
return Redirect::to('/setup')->withInput();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$content = "<?php return 'production';";
|
||||||
|
$fp = fopen(base_path() . "/bootstrap/environment.php" , 'w');
|
||||||
|
fwrite($fp, $content);
|
||||||
|
fclose($fp);
|
||||||
|
|
||||||
$configDir = app_path() . '/config/production';
|
$configDir = app_path() . '/config/production';
|
||||||
if (!file_exists($configDir))
|
if (!file_exists($configDir))
|
||||||
{
|
{
|
||||||
@ -75,9 +80,9 @@ class AppController extends BaseController {
|
|||||||
$content = '<?php return ' . var_export($config, true) . ';';
|
$content = '<?php return ' . var_export($config, true) . ';';
|
||||||
$fp = fopen(app_path() . "/config/production/{$key}.php" , 'w');
|
$fp = fopen(app_path() . "/config/production/{$key}.php" , 'w');
|
||||||
fwrite($fp, $content);
|
fwrite($fp, $content);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
Artisan::call('migrate');
|
Artisan::call('migrate');
|
||||||
Artisan::call('db:seed');
|
Artisan::call('db:seed');
|
||||||
|
|
||||||
@ -94,7 +99,7 @@ class AppController extends BaseController {
|
|||||||
$user->amend();
|
$user->amend();
|
||||||
|
|
||||||
//Auth::login($user, true);
|
//Auth::login($user, true);
|
||||||
//self::register($user);
|
//$this->accountRepo->registerUser($user);
|
||||||
|
|
||||||
return Redirect::to('/invoices/create');
|
return Redirect::to('/invoices/create');
|
||||||
}
|
}
|
||||||
@ -150,27 +155,6 @@ class AppController extends BaseController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function register($user)
|
|
||||||
{
|
|
||||||
$url = NINJA_APP_URL . '/signup/register';
|
|
||||||
$data = '';
|
|
||||||
$fields = [
|
|
||||||
'first_name' => urlencode($user->first_name),
|
|
||||||
'last_name' => urlencode($user->last_name),
|
|
||||||
'email' => urlencode($user->email)
|
|
||||||
];
|
|
||||||
|
|
||||||
foreach($fields as $key=>$value) { $data .= $key.'='.$value.'&'; }
|
|
||||||
rtrim($data, '&');
|
|
||||||
|
|
||||||
$ch = curl_init();
|
|
||||||
curl_setopt($ch,CURLOPT_URL, $url);
|
|
||||||
curl_setopt($ch,CURLOPT_POST, count($fields));
|
|
||||||
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
|
|
||||||
curl_exec($ch);
|
|
||||||
curl_close($ch);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function install()
|
public function install()
|
||||||
{
|
{
|
||||||
if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
|
if (!Utils::isNinja() && !Utils::isDatabaseSetup()) {
|
||||||
|
@ -222,4 +222,25 @@ class AccountRepository
|
|||||||
return $client;
|
return $client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function registerUser($user)
|
||||||
|
{
|
||||||
|
$url = NINJA_APP_URL . '/signup/register';
|
||||||
|
$data = '';
|
||||||
|
$fields = [
|
||||||
|
'first_name' => urlencode($user->first_name),
|
||||||
|
'last_name' => urlencode($user->last_name),
|
||||||
|
'email' => urlencode($user->email)
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach($fields as $key=>$value) { $data .= $key.'='.$value.'&'; }
|
||||||
|
rtrim($data, '&');
|
||||||
|
|
||||||
|
$ch = curl_init();
|
||||||
|
curl_setopt($ch,CURLOPT_URL, $url);
|
||||||
|
curl_setopt($ch,CURLOPT_POST, count($fields));
|
||||||
|
curl_setopt($ch,CURLOPT_POSTFIELDS, $data);
|
||||||
|
curl_exec($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -17,6 +17,8 @@
|
|||||||
|
|
||||||
<div class="jumbotron">
|
<div class="jumbotron">
|
||||||
<h2>Invoice Ninja Setup</h2>
|
<h2>Invoice Ninja Setup</h2>
|
||||||
|
If you need help you can either post to our <a href="https://groups.google.com/forum/#!forum/invoiceninja" target="_blank">Google Group</a>
|
||||||
|
or email us at <a href="mailto:contact@invoiceninja.com" target="_blank">contact@invoiceninja.com</a>.
|
||||||
<p>
|
<p>
|
||||||
<pre>-- Commands to create a MySQL database and user
|
<pre>-- Commands to create a MySQL database and user
|
||||||
CREATE SCHEMA `ninja` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
CREATE SCHEMA `ninja` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
|
||||||
@ -24,11 +26,20 @@ CREATE USER 'ninja'@'localhost' IDENTIFIED BY 'ninja';
|
|||||||
GRANT ALL PRIVILEGES ON `ninja`.* TO 'ninja'@'localhost';
|
GRANT ALL PRIVILEGES ON `ninja`.* TO 'ninja'@'localhost';
|
||||||
FLUSH PRIVILEGES;</pre>
|
FLUSH PRIVILEGES;</pre>
|
||||||
</p>
|
</p>
|
||||||
If you need help you can either post to our <a href="https://groups.google.com/forum/#!forum/invoiceninja" target="_blank">Google Group</a>
|
|
||||||
or email us at <a href="mailto:contact@invoiceninja.com" target="_blank">contact@invoiceninja.com</a>.
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ Former::open() }}
|
{{ Former::open()->rules([
|
||||||
|
'app[url]' => 'required',
|
||||||
|
'database[type][host]' => 'required',
|
||||||
|
'database[type][database]' => 'required',
|
||||||
|
'database[type][username]' => 'required',
|
||||||
|
'database[type][password]' => 'required',
|
||||||
|
'first_name' => 'required',
|
||||||
|
'last_name' => 'required',
|
||||||
|
'email' => 'required|email',
|
||||||
|
'password' => 'required',
|
||||||
|
'terms_checkbox' => 'required'
|
||||||
|
]) }}
|
||||||
|
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
<div class="panel-heading">
|
<div class="panel-heading">
|
||||||
@ -48,7 +59,7 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
{{ Former::text('database[type][host]')->label('Host')->value('localhost') }}
|
{{ Former::text('database[type][host]')->label('Host')->value('localhost') }}
|
||||||
{{ Former::text('database[type][database]')->label('Database')->value('ninja') }}
|
{{ Former::text('database[type][database]')->label('Database')->value('ninja') }}
|
||||||
{{ Former::text('database[type][username]')->label('Username')->value('ninja') }}
|
{{ Former::text('database[type][username]')->label('Username')->value('ninja') }}
|
||||||
{{ Former::text('database[type][password]')->label('Password')->value('ninja') }}
|
{{ Former::password('database[type][password]')->label('Password')->value('ninja') }}
|
||||||
{{ Former::actions( Button::normal('Test connection', ['onclick' => 'testDatabase()']), ' <span id="dbTestResult"/>' ) }}
|
{{ Former::actions( Button::normal('Test connection', ['onclick' => 'testDatabase()']), ' <span id="dbTestResult"/>' ) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -65,7 +76,7 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
{{ Former::select('mail[encryption]')->label('Encryption')->options(['tls' => 'TLS', 'ssl' => 'SSL']) }}
|
{{ Former::select('mail[encryption]')->label('Encryption')->options(['tls' => 'TLS', 'ssl' => 'SSL']) }}
|
||||||
{{ 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::text('mail[password]')->label('Password') }}
|
{{ Former::password('mail[password]')->label('Password') }}
|
||||||
{{ Former::actions( Button::normal('Send test email', ['onclick' => 'testMail()']), ' <span id="mailTestResult"/>' ) }}
|
{{ Former::actions( Button::normal('Send test email', ['onclick' => 'testMail()']), ' <span id="mailTestResult"/>' ) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -83,6 +94,7 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
</div>
|
</div>
|
||||||
</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::actions( Button::submit_lg('Submit') ) }}
|
{{ Former::actions( Button::submit_lg('Submit') ) }}
|
||||||
{{ Former::close() }}
|
{{ Former::close() }}
|
||||||
|
|
||||||
@ -108,6 +120,13 @@ FLUSH PRIVILEGES;</pre>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// http://stackoverflow.com/questions/585396/how-to-prevent-enter-keypress-to-submit-a-web-form
|
||||||
|
$("form").bind("keypress", function (e) {
|
||||||
|
if (e.keyCode == 13) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user