From 06eb6ad240e7ba1ed61444d52a9bf03f9549c972 Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 2 Dec 2013 21:54:24 +0200 Subject: [PATCH] Working on sign up form --- LICENSE | 53 ++++++++---- app/controllers/AccountController.php | 8 +- ...11_05_180133_confide_setup_users_table.php | 4 +- app/models/User.php | 2 +- app/routes.php | 1 + app/views/accounts/details.blade.php | 6 +- app/views/header.blade.php | 84 ++++++++++++++++++- public/js/script.js | 6 +- 8 files changed, 132 insertions(+), 32 deletions(-) diff --git a/LICENSE b/LICENSE index 88df5edc6765..129def0208b1 100644 --- a/LICENSE +++ b/LICENSE @@ -1,20 +1,39 @@ -The MIT License (MIT) +Attribution Assurance License +Copyright (c) 2013 by Hillel Coren +http://www.hillelcoren.com -Copyright (c) 2013 hillelcoren +All Rights Reserved +ATTRIBUTION ASSURANCE LICENSE (adapted from the original BSD license) +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the conditions below are met. +These conditions require a modest attribution to InvoiceNinja.com. The hope +is that its promotional value may help justify the thousands of dollars in +otherwise billable time invested in writing this and other freely available, +open-source software. -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: +1. Redistributions of source code, in whole or part and with or without +modification (the "Code"), must prominently display "Powered by InvoiceNinja.com" +in verifiable form with a link to said site. +2. Neither the name nor any trademark of the Author may be used to +endorse or promote products derived from this software without specific +prior written permission. +3. Users are entirely responsible, to the exclusion of the Author and +any other persons, for compliance with (1) regulations set by owners or +administrators of employed equipment, (2) licensing terms of any other +software, and (3) local regulations regarding use, including those +regarding import, export, and use of encryption software. -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +THIS FREE SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +EVENT SHALL THE AUTHOR OR ANY CONTRIBUTOR BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +EFFECTS OF UNAUTHORIZED OR MALICIOUS NETWORK ACCESS; +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED +AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN +IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index cb977de9077f..855c54f64f80 100755 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -29,10 +29,10 @@ class AccountController extends \BaseController { $random = str_random(20); $user = new User; - $user->username = $random.'@gmail.com'; - $user->password = $random; - $user->email = $random.'@gmail.com'; - $user->password_confirmation = $random; + //$user->username = $random.'@gmail.com'; + //$user->password = $random; + //$user->email = $random.'@gmail.com'; + //$user->password_confirmation = $random; $account->users()->save($user); } diff --git a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php index e3909ed58e86..6a5fe34b9884 100755 --- a/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php +++ b/app/database/migrations/2013_11_05_180133_confide_setup_users_table.php @@ -115,10 +115,10 @@ class ConfideSetupUsersTable extends Migration { $t->string('last_name'); $t->string('phone'); $t->string('username'); - $t->string('email'); + $t->string('email')->unique(); $t->string('password'); $t->string('confirmation_code'); - $t->boolean('is_guest')->default(true); + $t->boolean('registered')->default(false); $t->boolean('confirmed')->default(false); $t->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade'); diff --git a/app/models/User.php b/app/models/User.php index 1ce2932917ff..c9fa06b68015 100755 --- a/app/models/User.php +++ b/app/models/User.php @@ -84,5 +84,5 @@ class User extends ConfideUser implements UserInterface, RemindableInterface, iP { return $fullName; } - } + } } \ No newline at end of file diff --git a/app/routes.php b/app/routes.php index fa7dfda64e87..54e52414f071 100755 --- a/app/routes.php +++ b/app/routes.php @@ -36,6 +36,7 @@ Route::group(array('before' => array('auth', 'csrf')), function() Route::get('account/{section?}', 'AccountController@showSection'); Route::post('account/{section?}', 'AccountController@doSection'); + Route::resource('clients', 'ClientController'); Route::get('api/clients', array('as'=>'api.clients', 'uses'=>'ClientController@getDatatable')); Route::get('api/activities/{client_id?}', array('as'=>'api.activities', 'uses'=>'ActivityController@getDatatable')); diff --git a/app/views/accounts/details.blade.php b/app/views/accounts/details.blade.php index b18efe24341b..dbfd5e0184bb 100755 --- a/app/views/accounts/details.blade.php +++ b/app/views/accounts/details.blade.php @@ -19,9 +19,7 @@ {{ Former::populate($account); }} {{ Former::populateField('first_name', $account->users()->first()->first_name) }} {{ Former::populateField('last_name', $account->users()->first()->last_name) }} - @if (!$account->users()->first()->is_guest) - {{ Former::populateField('email', $account->users()->first()->email) }} - @endif + {{ Former::populateField('email', $account->users()->first()->email) }} {{ Former::populateField('phone', $account->users()->first()->phone) }}
@@ -55,7 +53,7 @@ {{ Former::legend('Users') }} {{ Former::text('first_name') }} {{ Former::text('last_name') }} - {{ Former::text('email')->label('Email/Username') }} + {{ Former::text('email') }} {{ Former::text('phone') }}
diff --git a/app/views/header.blade.php b/app/views/header.blade.php index 75f6de9a0ff9..7c9726f9e888 100755 --- a/app/views/header.blade.php +++ b/app/views/header.blade.php @@ -233,8 +233,13 @@
Invoice Ninja
- Logged in as Guest (Sign up) | {{ link_to('account/details', 'My Account') }} -

This is a sample site, the data is erased

+ @if (Auth::user()->registered) + + @else + {{ Button::sm_primary('Sign up', array('data-toggle'=>'modal', 'data-target'=>'#signUpModal')); }}   + {{ link_to('account/details', 'My Account'); }} + @endif +

This is a sample site, the data is erased.

@@ -290,6 +295,35 @@ + + + @if (!Auth::user()->registered) + + @endif @@ -297,6 +331,48 @@