- Preparing for open source

This commit is contained in:
Dave 2016-03-02 23:37:33 +00:00
parent 6af8a787bd
commit fd3d39ab38
7 changed files with 53 additions and 44 deletions

View File

@ -1,7 +1,5 @@
<?php namespace App\Http\Controllers;
use App\Models\Account;
use App\Models\Timezone;
use View;
use Response;
use Config;
@ -11,6 +9,7 @@ use Artisan;
use DB;
use File;
use App\Http\Controllers\Controller;
use App\Models\Timezone;
class InstallerController extends Controller
@ -18,7 +17,9 @@ class InstallerController extends Controller
public function __construct()
{
set_time_limit(300);
if(file_exists(base_path('installed'))) {
abort(403, 'Unauthorized action.');
}
}
public function showInstaller()
@ -35,7 +36,7 @@ class InstallerController extends Controller
'pdo',
'mbstring',
'fileinfo',
'tokenizer',
'tokenizer'
];
return View::make('Installer.Installer', $data);
@ -43,6 +44,7 @@ class InstallerController extends Controller
public function postInstaller()
{
set_time_limit(300);
$database['type'] = 'mysql';
$database['host'] = Input::get('database_host');
@ -61,6 +63,7 @@ class InstallerController extends Controller
$app_url = Input::get('app_url');
$app_key = str_random(16);
$version = file_get_contents(base_path('VERSION'));
if (Input::get('test') === 'db') {
@ -105,6 +108,14 @@ class InstallerController extends Controller
fwrite($fp, $config);
fclose($fp);
Config::set('database.default', $database['type']);
Config::set("database.connections.mysql.host", $database['host']);
Config::set("database.connections.mysql.database", $database['name']);
Config::set("database.connections.mysql.username", $database['username']);
Config::set("database.connections.mysql.password", $database['password']);
DB::reconnect();
Artisan::call('migrate', array('--force' => true));
if (Timezone::count() == 0) {
Artisan::call('db:seed', array('--force' => true));
@ -112,7 +123,7 @@ class InstallerController extends Controller
Artisan::call('optimize', array('--force' => true));
$fp = fopen(base_path()."/installed", 'w');
fwrite($fp, '0.1.0');
fwrite($fp, $version);
fclose($fp);
return Redirect::route('showSignup',['first_run' => 'yup']);

View File

@ -32,10 +32,6 @@ class UserSignupController extends Controller {
return View::make('Public.LoginAndRegister.Signup');
}
/*
* Validate an email
*/
/**
* Creates an account
@ -47,7 +43,7 @@ class UserSignupController extends Controller {
'email' => array('required', 'email', 'unique:users'),
'password' => array('required', 'min:5', 'confirmed'),
'first_name' => array('required'),
'terms_agreed' => array('required')
'terms_agreed' => Utils::isAttendize() ? array('required') : ''
);
$messages = array(
@ -85,16 +81,14 @@ class UserSignupController extends Controller {
$user->save();
/*
* Send a confirmation email.
* NOTE: $user->confirmation_code is generated by the model in the background
*/
\Mail::send('Emails.ConfirmEmail', ['first_name' => $user->first_name, 'confirmation_code' => $user->confirmation_code], function($message) {
$message->to(Input::get('email'), Input::get('first_name'))
->subject('Thank you for registering for Attendize');
});
if(Utils::isAttendize()) {
Mail::send('Emails.ConfirmEmail', ['first_name' => $user->first_name, 'confirmation_code' => $user->confirmation_code], function($message) {
$message->to(Input::get('email'), Input::get('first_name'))
->subject('Thank you for registering for Attendize');
});
}
\Session::flash('message', "Success! You can now login.");
Session::flash('message', "Success! You can now login.");
return Redirect::to('login');
}

View File

@ -11,14 +11,6 @@
|
*/
Route::get('emailtest', function(){
return View::make('Emails.Layouts.Master', [
'message' => 'Hello.',
'email_logo' => asset('assets/images/logo-email.png')
]);
});
/*
* Installer
*/

View File

@ -127,7 +127,6 @@ return [
'Intervention\Image\ImageServiceProvider',
'Maatwebsite\Excel\ExcelServiceProvider',
'Laravel\Socialite\SocialiteServiceProvider',
'Barryvdh\Debugbar\ServiceProvider',
'Nitmedia\Wkhtml2pdf\L5Wkhtml2pdfServiceProvider',
'Mews\Purifier\PurifierServiceProvider',
'MaxHoffmann\Parsedown\ParsedownServiceProvider',

View File

@ -159,19 +159,6 @@
<h3>Email Settings</h3>
<div class="form-group ">
{!! Form::label('mail_driver', 'Mail Driver', array('class'=>' control-label required')) !!}
{!! Form::text('mail_driver', Input::old('mail_driver'),
array(
'class'=>'form-control ',
'placeholder' => 'mail'
)) !!}
<div class="help-block">
To use PHP's <a target="_blank" href="http://php.net/manual/en/function.mail.php">mail</a>
feature simmple enter <b>mail</b> in this box and leave the below fields empty.
</div>
</div>
<div class="form-group ">
{!! Form::label('mail_from_address', 'Mail From Address', array('class'=>' control-label required')) !!}
{!! Form::text('mail_from_address', Input::old('mail_from_address'),
@ -186,6 +173,19 @@
'class'=>'form-control'
)) !!}
</div>
<div class="form-group ">
{!! Form::label('mail_driver', 'Mail Driver', array('class'=>' control-label required')) !!}
{!! Form::text('mail_driver', Input::old('mail_driver'),
array(
'class'=>'form-control ',
'placeholder' => 'mail'
)) !!}
<div class="help-block">
To use PHP's <a target="_blank" href="http://php.net/manual/en/function.mail.php">mail</a>
feature enter <b>mail</b> in this box and leave the below fields empty.
</div>
</div>
<div class="form-group ">
{!! Form::label('mail_port', 'Mail Port', array('class'=>' control-label ')) !!}
{!! Form::text('mail_port', Input::old('mail_port'),
@ -223,8 +223,15 @@
</div>
<div class="well">
The install make take several minutes to complete. If you need help you can email us at <a href="mailto:dave@attendize.com" target="_blank">help@attendize.com</a>.
<p>
Installation may make take several minutes to complete. Once you click '<b>Install Attendize</b>' the config settings will be written to this file: <b>{{base_path('.env')}}</b>. You can manually change these settings in the future by editing this file.
</p>
<p>
If the install fails be sure to check the log file in <b>{{storage_path('logs')}}</b> to find the error.
</p>
<p>
If you need help you can email us at <a href="mailto:help@attendize.com" target="_blank">help@attendize.com</a>.
</p>
</div>

View File

@ -42,9 +42,12 @@
<button type="submit" class="btn btn-block btn-success">Login</button>
</div>
@if(Utils::isAttendize())
<div class="signup">
<span>Don't have any account? <a class="semibold" href="/signup">Sign up</a></span>
</div>
@endif
</div>

View File

@ -53,7 +53,8 @@ Sign Up
{!! Form::label('password_confirmation', 'Password again') !!}
{!! Form::password('password_confirmation', ['class' => 'form-control']) !!}
</div>
@if(Utils::isAttendize())
<div class="form-group">
<div class="row">
<div class="col-xs-12">
@ -64,6 +65,8 @@ Sign Up
</div>
</div>
</div>
@endif
<div class="form-group ">
{!! Form::submit('Sign Up', array('class'=>"btn btn-block btn-success")) !!}
</div>