mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Working on sign up form
This commit is contained in:
parent
dd088d8668
commit
06eb6ad240
53
LICENSE
53
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.
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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'));
|
||||
|
@ -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('phone', $account->users()->first()->phone) }}
|
||||
|
||||
<div class="row">
|
||||
@ -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') }}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -233,8 +233,13 @@
|
||||
<div>
|
||||
<span style="font-size:30px">Invoice Ninja</span>
|
||||
<div style="float:right;text-align:right">
|
||||
Logged in as Guest (<u>Sign up</u>) | {{ link_to('account/details', 'My Account') }}
|
||||
<p class="text-danger">This is a sample site, the data is erased</p>
|
||||
@if (Auth::user()->registered)
|
||||
|
||||
@else
|
||||
{{ Button::sm_primary('Sign up', array('data-toggle'=>'modal', 'data-target'=>'#signUpModal')); }}
|
||||
{{ link_to('account/details', 'My Account'); }}
|
||||
@endif
|
||||
<p class="text-danger">This is a sample site, the data is erased.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -292,11 +297,82 @@
|
||||
</div>
|
||||
|
||||
|
||||
@if (!Auth::user()->registered)
|
||||
<div class="modal fade" id="signUpModal" tabindex="-1" role="dialog" aria-labelledby="signUpModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<h4 class="modal-title" id="myModalLabel">Sign Up</h4>
|
||||
</div>
|
||||
|
||||
<div style="padding-right:20px" onkeyup="validateSignUp()" onkeydown="checkForEnter(event)">
|
||||
{{ Former::open(); }}
|
||||
{{ Former::populate(Auth::user()) }}
|
||||
{{ Former::text('first_name'); }}
|
||||
{{ Former::text('last_name'); }}
|
||||
{{ Former::text('email'); }}
|
||||
{{ Former::password('password'); }}
|
||||
{{ Former::close(); }}
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
<button type="button" class="btn btn-primary" onclick="submitSignUp()">Save</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
@if (!Auth::user()->registered)
|
||||
function validateSignUp(showError)
|
||||
{
|
||||
var isValid = true;
|
||||
$(['first_name','last_name','email','password']).each(function(i, field) {
|
||||
var $input = $('#'+field),
|
||||
val = $.trim($input.val());
|
||||
var isValid = val && val.length > (field == 'password' ? 6 : 0);
|
||||
if (isValid && field == 'email') {
|
||||
isValid = isValidEmailAddress(val);
|
||||
}
|
||||
if (isValid) {
|
||||
$input.closest('div.form-group').removeClass('has-error');
|
||||
$input.closest('div.form-group').addClass('has-success');
|
||||
} else {
|
||||
isValid = false;
|
||||
$input.closest('div.form-group').removeClass('has-success');
|
||||
if (showError) {
|
||||
$input.closest('div.form-group').addClass('has-error');
|
||||
}
|
||||
}
|
||||
});
|
||||
return isValid;
|
||||
}
|
||||
|
||||
function submitSignUp()
|
||||
{
|
||||
if (!validateSignUp(true)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function checkForEnter(event)
|
||||
{
|
||||
if (event.keyCode === 13){
|
||||
event.preventDefault();
|
||||
submitSignUp();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@endif
|
||||
|
||||
$(function() {
|
||||
|
||||
@if (Auth::user()->is_guest)
|
||||
@ -305,6 +381,10 @@
|
||||
}
|
||||
@endif
|
||||
|
||||
@if (!Auth::user()->registered)
|
||||
validateSignUp();
|
||||
@endif
|
||||
|
||||
@yield('onReady')
|
||||
});
|
||||
|
||||
|
@ -358,5 +358,7 @@ function isStorageSupported() {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function isValidEmailAddress(emailAddress) {
|
||||
var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i);
|
||||
return pattern.test(emailAddress);
|
||||
};
|
Loading…
Reference in New Issue
Block a user