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

View File

@ -33,10 +33,6 @@ class UserSignupController extends Controller {
} }
/*
* Validate an email
*/
/** /**
* Creates an account * Creates an account
* *
@ -47,7 +43,7 @@ class UserSignupController extends Controller {
'email' => array('required', 'email', 'unique:users'), 'email' => array('required', 'email', 'unique:users'),
'password' => array('required', 'min:5', 'confirmed'), 'password' => array('required', 'min:5', 'confirmed'),
'first_name' => array('required'), 'first_name' => array('required'),
'terms_agreed' => array('required') 'terms_agreed' => Utils::isAttendize() ? array('required') : ''
); );
$messages = array( $messages = array(
@ -85,16 +81,14 @@ class UserSignupController extends Controller {
$user->save(); $user->save();
/* if(Utils::isAttendize()) {
* Send a confirmation email. Mail::send('Emails.ConfirmEmail', ['first_name' => $user->first_name, 'confirmation_code' => $user->confirmation_code], function($message) {
* NOTE: $user->confirmation_code is generated by the model in the background $message->to(Input::get('email'), Input::get('first_name'))
*/ ->subject('Thank you for registering for Attendize');
\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'); 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 * Installer
*/ */

View File

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

View File

@ -159,19 +159,6 @@
<h3>Email Settings</h3> <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 "> <div class="form-group ">
{!! Form::label('mail_from_address', 'Mail From Address', array('class'=>' control-label required')) !!} {!! Form::label('mail_from_address', 'Mail From Address', array('class'=>' control-label required')) !!}
{!! Form::text('mail_from_address', Input::old('mail_from_address'), {!! Form::text('mail_from_address', Input::old('mail_from_address'),
@ -186,6 +173,19 @@
'class'=>'form-control' 'class'=>'form-control'
)) !!} )) !!}
</div> </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 "> <div class="form-group ">
{!! Form::label('mail_port', 'Mail Port', array('class'=>' control-label ')) !!} {!! Form::label('mail_port', 'Mail Port', array('class'=>' control-label ')) !!}
{!! Form::text('mail_port', Input::old('mail_port'), {!! Form::text('mail_port', Input::old('mail_port'),
@ -223,8 +223,15 @@
</div> </div>
<div class="well"> <div class="well">
<p>
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>. 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> </div>

View File

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

View File

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