mirror of
				https://github.com/invoiceninja/invoiceninja.git
				synced 2025-11-03 23:27:31 -05:00 
			
		
		
		
	Sign up (#2460)
* Privacy Policy & TOS * configure additional dependency packages for redis and modules, middleware implementation for multi-db * Stub the signup
This commit is contained in:
		
							parent
							
								
									0f64ade43f
								
							
						
					
					
						commit
						103a95955a
					
				@ -14,6 +14,8 @@ if (! defined('APP_NAME')) {
 | 
			
		||||
    define('CONTACT_EMAIL', env('MAIL_FROM_ADDRESS'));
 | 
			
		||||
    define('CONTACT_NAME', env('MAIL_FROM_NAME'));
 | 
			
		||||
    define('SITE_URL', env('APP_URL'));
 | 
			
		||||
    define('APP_VERSION', env('APP_VERSION'));
 | 
			
		||||
    define('NINJA_TERMS_VERSION', '1.0.1');
 | 
			
		||||
 | 
			
		||||
    define('ENV_DEVELOPMENT', 'local');
 | 
			
		||||
    define('ENV_STAGING', 'staging');
 | 
			
		||||
@ -24,6 +26,7 @@ if (! defined('APP_NAME')) {
 | 
			
		||||
 | 
			
		||||
    define('BANK_LIBRARY_OFX', 1);
 | 
			
		||||
    define('MULTI_DBS', serialize(['db-ninja-1', 'db-ninja-2']));
 | 
			
		||||
    define('RANDOM_KEY_LENGTH', 32); //63340286662973277706162286946811886609896461828096 combinations
 | 
			
		||||
 | 
			
		||||
    define('SOCIAL_GOOGLE', 'Google');
 | 
			
		||||
    define('SOCIAL_FACEBOOK', 'Facebook');
 | 
			
		||||
@ -31,4 +34,18 @@ if (! defined('APP_NAME')) {
 | 
			
		||||
    define('SOCIAL_LINKEDIN', 'LinkedIn');
 | 
			
		||||
    define('SOCIAL_TWITTER', 'Twitter');
 | 
			
		||||
    define('SOCIAL_BITBUCKET', 'Bitbucket');
 | 
			
		||||
 | 
			
		||||
    define('CURRENCY_DOLLAR', 1);
 | 
			
		||||
    define('CURRENCY_EURO', 3);
 | 
			
		||||
 | 
			
		||||
    define('DEFAULT_TIMEZONE', 'US/Eastern');
 | 
			
		||||
    define('DEFAULT_COUNTRY', 840); // United Stated
 | 
			
		||||
    define('DEFAULT_CURRENCY', CURRENCY_DOLLAR);
 | 
			
		||||
    define('DEFAULT_LANGUAGE', 1); // English
 | 
			
		||||
    define('DEFAULT_DATE_FORMAT', 'M j, Y');
 | 
			
		||||
    define('DEFAULT_DATE_PICKER_FORMAT', 'M d, yyyy');
 | 
			
		||||
    define('DEFAULT_DATETIME_FORMAT', 'F j, Y g:i a');
 | 
			
		||||
    define('DEFAULT_DATETIME_MOMENT_FORMAT', 'MMM D, YYYY h:mm:ss a');
 | 
			
		||||
    define('DEFAULT_LOCALE', 'en');
 | 
			
		||||
    define('DEFAULT_MAP_ZOOM', 10);
 | 
			
		||||
}
 | 
			
		||||
@ -3,6 +3,10 @@
 | 
			
		||||
namespace App\Http\Controllers;
 | 
			
		||||
 | 
			
		||||
use App\Http\Requests\SignupRequest;
 | 
			
		||||
use App\Models\Account;
 | 
			
		||||
use App\Models\User;
 | 
			
		||||
use App\Models\UserAccount;
 | 
			
		||||
use Illuminate\Support\Facades\Hash;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Class SignupController
 | 
			
		||||
@ -32,7 +36,39 @@ class SignupController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function processSignup(SignupRequest $request)
 | 
			
		||||
    {
 | 
			
		||||
        dd($request->validated());
 | 
			
		||||
        //dd($request->validated());
 | 
			
		||||
 | 
			
		||||
        //created new account
 | 
			
		||||
 | 
			
		||||
        $ac = new Account();
 | 
			
		||||
        $ac->name = $request->first_name. ' ' .$request->last_name;
 | 
			
		||||
        $ac->account_key = strtolower(str_random(RANDOM_KEY_LENGTH));
 | 
			
		||||
        $ac->ip = $request->ip();
 | 
			
		||||
        $ac->save();
 | 
			
		||||
 | 
			
		||||
        $user = new User();
 | 
			
		||||
        $user->password = Hash::make($request->input('password'));
 | 
			
		||||
        $user->accepted_terms_version = NINJA_TERMS_VERSION;
 | 
			
		||||
        $user->db = config('database.default');
 | 
			
		||||
        $user->fill($request->all());
 | 
			
		||||
        $user->save();
 | 
			
		||||
 | 
			
		||||
        $user_account = new UserAccount();
 | 
			
		||||
        $user_account->user_id = $user->id;
 | 
			
		||||
        $user_account->account_id = $ac->id;
 | 
			
		||||
        $user_account->is_owner = TRUE;
 | 
			
		||||
        $user_account->is_admin = TRUE;
 | 
			
		||||
        $user_account->is_default = TRUE;
 | 
			
		||||
        $user_account->is_locked = FALSE;
 | 
			
		||||
        $user_account->permissions = '';
 | 
			
		||||
        $user_account->save();
 | 
			
		||||
 | 
			
		||||
        dd($user);
 | 
			
		||||
        //log user in
 | 
			
		||||
 | 
			
		||||
        //fire account created job
 | 
			
		||||
 | 
			
		||||
        //redirect to localization setup workflow
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -42,7 +42,7 @@ class Kernel extends HttpKernel
 | 
			
		||||
            'bindings',
 | 
			
		||||
        ],
 | 
			
		||||
        'db' => [
 | 
			
		||||
 | 
			
		||||
            \App\Http\Middleware\SetDb::class,
 | 
			
		||||
        ],
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ namespace App\Http\Middleware;
 | 
			
		||||
use App\Libraries\MultiDB;
 | 
			
		||||
use Closure;
 | 
			
		||||
 | 
			
		||||
class setDb
 | 
			
		||||
class SetDb
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Handle an incoming request.
 | 
			
		||||
@ -16,9 +16,9 @@ class setDb
 | 
			
		||||
     */
 | 
			
		||||
    public function handle($request, Closure $next)
 | 
			
		||||
    {
 | 
			
		||||
        if (!config('auth.providers.users.driver') == 'eloquent')  {
 | 
			
		||||
 | 
			
		||||
            //MultiDB::setDB(auth()->user()->)
 | 
			
		||||
        if (! config('auth.providers.users.driver') == 'eloquent')
 | 
			
		||||
        {
 | 
			
		||||
            MultiDB::setDB(auth()->user()->db);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $next($request);
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ namespace App\Http\Requests;
 | 
			
		||||
 | 
			
		||||
use App\Http\ValidationRules\UniqueUserRule;
 | 
			
		||||
use Illuminate\Support\Facades\Auth;
 | 
			
		||||
use Illuminate\Support\Facades\Hash;
 | 
			
		||||
 | 
			
		||||
class SignupRequest extends Request
 | 
			
		||||
{
 | 
			
		||||
@ -15,7 +16,7 @@ class SignupRequest extends Request
 | 
			
		||||
     */
 | 
			
		||||
    public function authorize()
 | 
			
		||||
    {
 | 
			
		||||
        return ! Auth::user();
 | 
			
		||||
        return ! auth()->user();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -35,4 +36,14 @@ class SignupRequest extends Request
 | 
			
		||||
            'terms_of_service'  => 'required'
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function sanitize()
 | 
			
		||||
    {
 | 
			
		||||
        $input = $this->all();
 | 
			
		||||
 | 
			
		||||
        //        $this->replace($input);
 | 
			
		||||
 | 
			
		||||
        return $this->all();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -63,9 +63,8 @@ class MultiDB
 | 
			
		||||
     */
 | 
			
		||||
    public static function setDB($database) : void
 | 
			
		||||
    {
 | 
			
		||||
        /* This will set the default configuration for the request */
 | 
			
		||||
        /* This will set the database connection for the request */
 | 
			
		||||
        config(['database.default' => $database]);
 | 
			
		||||
        app('db')->connection(config('database.connections.database.'.$database));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@ -13,6 +13,9 @@ class User extends Authenticatable
 | 
			
		||||
    use SoftDeletes;
 | 
			
		||||
 | 
			
		||||
    protected $guard = 'user';
 | 
			
		||||
 | 
			
		||||
    protected $dates = ['deleted_at'];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * The attributes that are mass assignable.
 | 
			
		||||
     *
 | 
			
		||||
@ -22,10 +25,10 @@ class User extends Authenticatable
 | 
			
		||||
        'first_name',
 | 
			
		||||
        'last_name',
 | 
			
		||||
        'email',
 | 
			
		||||
        'password',
 | 
			
		||||
        'phone',
 | 
			
		||||
        'signature',
 | 
			
		||||
        'avatar',
 | 
			
		||||
        'accepted_terms_version'
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@ -34,7 +37,6 @@ class User extends Authenticatable
 | 
			
		||||
     * @var array
 | 
			
		||||
     */
 | 
			
		||||
    protected $hidden = [
 | 
			
		||||
        'password',
 | 
			
		||||
        'remember_token',
 | 
			
		||||
        'confirmation_code',
 | 
			
		||||
        'oauth_user_id',
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,8 @@
 | 
			
		||||
        "laravel/framework": "5.7.*",
 | 
			
		||||
        "laravel/socialite": "^3.1",
 | 
			
		||||
        "laravel/tinker": "^1.0",
 | 
			
		||||
        "nwidart/laravel-modules": "^4.0",
 | 
			
		||||
        "predis/predis": "^1.1",
 | 
			
		||||
        "spatie/laravel-html": "^2.19",
 | 
			
		||||
        "webpatser/laravel-countries": "dev-master#75992ad"
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										122
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										122
									
								
								composer.lock
									
									
									
										generated
									
									
									
								
							@ -4,7 +4,7 @@
 | 
			
		||||
        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
 | 
			
		||||
        "This file is @generated automatically"
 | 
			
		||||
    ],
 | 
			
		||||
    "content-hash": "0a3a5aeaabd9e3362e0da55be647367c",
 | 
			
		||||
    "content-hash": "b059d33c67d5ecfe4b761dbc55f4e326",
 | 
			
		||||
    "packages": [
 | 
			
		||||
        {
 | 
			
		||||
            "name": "asgrim/ofxparser",
 | 
			
		||||
@ -1347,6 +1347,76 @@
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2018-10-10T09:24:14+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "nwidart/laravel-modules",
 | 
			
		||||
            "version": "4.0.0",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/nWidart/laravel-modules.git",
 | 
			
		||||
                "reference": "d487d9be3bfd6b7365678fd805d9ba5f0dd8295c"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/nWidart/laravel-modules/zipball/d487d9be3bfd6b7365678fd805d9ba5f0dd8295c",
 | 
			
		||||
                "reference": "d487d9be3bfd6b7365678fd805d9ba5f0dd8295c",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "php": ">=7.1"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "friendsofphp/php-cs-fixer": "^2.7",
 | 
			
		||||
                "laravel/framework": "5.7.*",
 | 
			
		||||
                "mockery/mockery": "~1.0",
 | 
			
		||||
                "orchestra/testbench": "^3.7",
 | 
			
		||||
                "phpstan/phpstan": "^0.9.2",
 | 
			
		||||
                "phpunit/phpunit": "~7.3",
 | 
			
		||||
                "spatie/phpunit-snapshot-assertions": "^1.0"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "extra": {
 | 
			
		||||
                "laravel": {
 | 
			
		||||
                    "providers": [
 | 
			
		||||
                        "Nwidart\\Modules\\LaravelModulesServiceProvider"
 | 
			
		||||
                    ],
 | 
			
		||||
                    "aliases": {
 | 
			
		||||
                        "Module": "Nwidart\\Modules\\Facades\\Module"
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                "branch-alias": {
 | 
			
		||||
                    "dev-master": "4.0-dev"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "Nwidart\\Modules\\": "src"
 | 
			
		||||
                },
 | 
			
		||||
                "files": [
 | 
			
		||||
                    "src/helpers.php"
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Nicolas Widart",
 | 
			
		||||
                    "email": "n.widart@gmail.com",
 | 
			
		||||
                    "homepage": "https://nicolaswidart.com",
 | 
			
		||||
                    "role": "Developer"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "Laravel Module management",
 | 
			
		||||
            "keywords": [
 | 
			
		||||
                "laravel",
 | 
			
		||||
                "module",
 | 
			
		||||
                "modules",
 | 
			
		||||
                "nwidart",
 | 
			
		||||
                "rad"
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2018-09-30T10:02:46+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "opis/closure",
 | 
			
		||||
            "version": "3.1.1",
 | 
			
		||||
@ -1453,6 +1523,56 @@
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2018-07-02T15:55:56+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "predis/predis",
 | 
			
		||||
            "version": "v1.1.1",
 | 
			
		||||
            "source": {
 | 
			
		||||
                "type": "git",
 | 
			
		||||
                "url": "https://github.com/nrk/predis.git",
 | 
			
		||||
                "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1"
 | 
			
		||||
            },
 | 
			
		||||
            "dist": {
 | 
			
		||||
                "type": "zip",
 | 
			
		||||
                "url": "https://api.github.com/repos/nrk/predis/zipball/f0210e38881631afeafb56ab43405a92cafd9fd1",
 | 
			
		||||
                "reference": "f0210e38881631afeafb56ab43405a92cafd9fd1",
 | 
			
		||||
                "shasum": ""
 | 
			
		||||
            },
 | 
			
		||||
            "require": {
 | 
			
		||||
                "php": ">=5.3.9"
 | 
			
		||||
            },
 | 
			
		||||
            "require-dev": {
 | 
			
		||||
                "phpunit/phpunit": "~4.8"
 | 
			
		||||
            },
 | 
			
		||||
            "suggest": {
 | 
			
		||||
                "ext-curl": "Allows access to Webdis when paired with phpiredis",
 | 
			
		||||
                "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol"
 | 
			
		||||
            },
 | 
			
		||||
            "type": "library",
 | 
			
		||||
            "autoload": {
 | 
			
		||||
                "psr-4": {
 | 
			
		||||
                    "Predis\\": "src/"
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            "notification-url": "https://packagist.org/downloads/",
 | 
			
		||||
            "license": [
 | 
			
		||||
                "MIT"
 | 
			
		||||
            ],
 | 
			
		||||
            "authors": [
 | 
			
		||||
                {
 | 
			
		||||
                    "name": "Daniele Alessandri",
 | 
			
		||||
                    "email": "suppakilla@gmail.com",
 | 
			
		||||
                    "homepage": "http://clorophilla.net"
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "description": "Flexible and feature-complete Redis client for PHP and HHVM",
 | 
			
		||||
            "homepage": "http://github.com/nrk/predis",
 | 
			
		||||
            "keywords": [
 | 
			
		||||
                "nosql",
 | 
			
		||||
                "predis",
 | 
			
		||||
                "redis"
 | 
			
		||||
            ],
 | 
			
		||||
            "time": "2016-06-16T16:22:20+00:00"
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "name": "psr/container",
 | 
			
		||||
            "version": "1.0.0",
 | 
			
		||||
 | 
			
		||||
@ -5,5 +5,17 @@ return [
 | 
			
		||||
    'web_url' => 'https://www.invoiceninja.com',
 | 
			
		||||
    'app_url' => 'https://app-v5.invoiceninja.com',
 | 
			
		||||
    'site_url' => '',
 | 
			
		||||
    'environment' => env('NINJA_ENVIRONMENT', 'selfhost'), // 'hosted', 'development', 'selfhost', 'reseller'
 | 
			
		||||
 | 
			
		||||
    // Settings used by invoiceninja.com
 | 
			
		||||
 | 
			
		||||
    'terms_of_service_url' => [
 | 
			
		||||
        'hosted' => env('TERMS_OF_SERVICE_URL', 'https://www.invoiceninja.com/terms/'),
 | 
			
		||||
        'selfhost' => env('TERMS_OF_SERVICE_URL', 'https://www.invoiceninja.com/self-hosting-terms-service/'),
 | 
			
		||||
    ],
 | 
			
		||||
 | 
			
		||||
    'privacy_policy_url' => [
 | 
			
		||||
        'hosted' => env('PRIVACY_POLICY_URL', 'https://www.invoiceninja.com/privacy-policy/'),
 | 
			
		||||
        'selfhost' => env('PRIVACY_POLICY_URL', 'https://www.invoiceninja.com/self-hosting-privacy-data-control/'),
 | 
			
		||||
    ],
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
@ -19,5 +19,6 @@ $factory->define(App\Models\Contact::class, function (Faker $faker) {
 | 
			
		||||
        'email'             => $faker->unique()->safeEmail,
 | 
			
		||||
        'password'          => bcrypt('secret'),
 | 
			
		||||
        'remember_token'    => str_random(10),
 | 
			
		||||
        'db'                => config('database.default')
 | 
			
		||||
    ];
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -22,5 +22,6 @@ $factory->define(App\Models\User::class, function (Faker $faker) {
 | 
			
		||||
        'email_verified_at' => now(),
 | 
			
		||||
        'password'          => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
 | 
			
		||||
        'remember_token'    => str_random(10),
 | 
			
		||||
        'db'                => config('database.default')
 | 
			
		||||
    ];
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@ -0,0 +1,63 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
use Illuminate\Support\Facades\Schema;
 | 
			
		||||
use Illuminate\Database\Schema\Blueprint;
 | 
			
		||||
use Illuminate\Database\Migrations\Migration;
 | 
			
		||||
 | 
			
		||||
class AddDbToUserTable extends Migration
 | 
			
		||||
{
 | 
			
		||||
    /**
 | 
			
		||||
     * Run the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function up()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::table('users', function (Blueprint $table) {
 | 
			
		||||
            $table->string('db', 100);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        Schema::table('contacts', function (Blueprint $table) {
 | 
			
		||||
            $table->string('db', 100);
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        Schema::table('users', function (Blueprint $table){
 | 
			
		||||
            $table->dropColumn('confirmed');
 | 
			
		||||
            $table->dropColumn('registered');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        Schema::table('contacts', function (Blueprint $table){
 | 
			
		||||
            $table->dropColumn('confirmed');
 | 
			
		||||
            $table->dropColumn('registered');
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * Reverse the migrations.
 | 
			
		||||
     *
 | 
			
		||||
     * @return void
 | 
			
		||||
     */
 | 
			
		||||
    public function down()
 | 
			
		||||
    {
 | 
			
		||||
        Schema::table('users', function (Blueprint $table) {
 | 
			
		||||
            $table->dropColumn('db');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        Schema::table('contacts', function (Blueprint $table) {
 | 
			
		||||
            $table->dropColumn('db');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        Schema::table('users', function (Blueprint $table){
 | 
			
		||||
            $table->boolean('confirmed');
 | 
			
		||||
            $table->boolean('registered');
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        Schema::table('contacts', function (Blueprint $table){
 | 
			
		||||
            $table->boolean('confirmed');
 | 
			
		||||
            $table->boolean('registered');
 | 
			
		||||
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@ -70,7 +70,7 @@
 | 
			
		||||
                                <i class="icon-lock"></i>
 | 
			
		||||
                              </span>
 | 
			
		||||
                            </div>
 | 
			
		||||
                            <input id="password" type="password" class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password" placeholder="@lang('texts.password')" required>
 | 
			
		||||
                            <input id="password" type="password" class="form-control" {{ $errors->has('password') ? ' is-invalid' : '' }} name="password" placeholder="@lang('texts.password')" required>
 | 
			
		||||
 | 
			
		||||
                            @if ($errors->has('password'))
 | 
			
		||||
                                <span class="invalid-feedback" role="alert">
 | 
			
		||||
@ -79,17 +79,19 @@
 | 
			
		||||
                            @endif
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="form-check">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="terms_of_service" name="terms_of_service" value="" v-model="checked1" {{(old('terms_of_service') == "1") ? 'checked': ''}}>
 | 
			
		||||
                        <div class="form-check" style="margin-top:10px; margin-bottom: 10px;">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="terms_of_service" name="terms_of_service" value="1" v-model="checked1" {{(old('terms_of_service') == "1") ? 'checked': ''}}>
 | 
			
		||||
                            <label class="form-check-label" for="terms_of_service">
 | 
			
		||||
                                @lang('texts.terms_of_service')
 | 
			
		||||
                                @lang('texts.agree_to_terms', ['terms' => ''])<a href=" {{config('ninja.terms_of_service_url.' . config('ninja.environment')) }}" target="_blank">@lang('texts.terms_of_service')</a>
 | 
			
		||||
 | 
			
		||||
                            </label>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
                        <div class="form-check">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="privacy_policy" name="privacy_policy" value="" v-model="checked2" {{(old('privacy_policy') == "1") ? 'checked': ''}}>
 | 
			
		||||
                        <div class="form-check" style="margin-top:10px; margin-bottom: 10px;">
 | 
			
		||||
                            <input class="form-check-input" type="checkbox" id="privacy_policy" name="privacy_policy" value="1" v-model="checked2" {{(old('privacy_policy') == "1") ? 'checked': ''}}>
 | 
			
		||||
                            <label class="form-check-label" for="privacy_policy">
 | 
			
		||||
                                @lang('texts.privacy_policy')
 | 
			
		||||
                                @lang('texts.agree_to_terms', ['terms' => ''])<a href=" {{config('ninja.privacy_policy_url.' . config('ninja.environment')) }}" target="_blank">@lang('texts.privacy_policy')</a>
 | 
			
		||||
 | 
			
		||||
                            </label>
 | 
			
		||||
                        </div>
 | 
			
		||||
 | 
			
		||||
@ -137,6 +139,4 @@
 | 
			
		||||
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@ -1,58 +1,45 @@
 | 
			
		||||
<?php
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
|--------------------------------------------------------------------------
 | 
			
		||||
| Web Routes
 | 
			
		||||
|--------------------------------------------------------------------------
 | 
			
		||||
|
 | 
			
		||||
| Here is where you can register web routes for your application. These
 | 
			
		||||
| routes are loaded by the RouteServiceProvider within a group which
 | 
			
		||||
| contains the "web" middleware group. Now create something great!
 | 
			
		||||
|
 | 
			
		||||
*/
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// Authentication Routes Laravel Defaults... replaces //Auth::routes();
 | 
			
		||||
 * Authentication Routes Laravel Defaults... replaces //Auth::routes();
 | 
			
		||||
 */
 | 
			
		||||
Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
 | 
			
		||||
Route::post('login', 'Auth\LoginController@login');
 | 
			
		||||
Route::post('logout', 'Auth\LoginController@logout')->name('logout');
 | 
			
		||||
 | 
			
		||||
// Social authentication
 | 
			
		||||
 | 
			
		||||
Route::get('auth/{provider}', 'Auth\LoginController@redirectToProvider');
 | 
			
		||||
Route::get('auth/{provider}/callback', 'Auth\LoginController@handleProviderCallback');
 | 
			
		||||
 | 
			
		||||
// Password Reset Routes...
 | 
			
		||||
/*
 | 
			
		||||
 * Signup Routes
 | 
			
		||||
 */
 | 
			
		||||
Route::redirect('/', '/login', 301);
 | 
			
		||||
Route::get('signup', 'SignupController@signup')->name('signup');
 | 
			
		||||
Route::post('process_signup', 'SignupController@processSignup')->name('signup.submit');
 | 
			
		||||
Route::get('contact/login', 'Auth\ContactLoginController@showLoginForm')->name('contact.login');
 | 
			
		||||
Route::post('contact/login', 'Auth\ContactLoginController@login')->name('contact.login.submit');
 | 
			
		||||
/*
 | 
			
		||||
 *  Password Reset Routes...
 | 
			
		||||
 */
 | 
			
		||||
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
 | 
			
		||||
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
 | 
			
		||||
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
 | 
			
		||||
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
Open Routes
 | 
			
		||||
 * Social authentication
 | 
			
		||||
 */
 | 
			
		||||
//Route::get('/', 'HomeController@index')->name('default');
 | 
			
		||||
Route::redirect('/', '/login', 301);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Route::get('/signup', 'SignupController@signup')->name('signup');
 | 
			
		||||
Route::post('/process_signup', 'SignupController@processSignup')->name('signup.submit');
 | 
			
		||||
 | 
			
		||||
Route::get('/contact/login', 'Auth\ContactLoginController@showLoginForm')->name('contact.login');
 | 
			
		||||
Route::post('/contact/login', 'Auth\ContactLoginController@login')->name('contact.login.submit');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Route::get('auth/{provider}', 'Auth\LoginController@redirectToProvider');
 | 
			
		||||
Route::get('auth/{provider}/callback', 'Auth\LoginController@handleProviderCallback');
 | 
			
		||||
/*
 | 
			
		||||
Authenticated User Routes
 | 
			
		||||
 * Authenticated User Routes
 | 
			
		||||
 */
 | 
			
		||||
Route::group(['middleware' => ['auth:user', 'db']], function () {
 | 
			
		||||
 | 
			
		||||
	Route::get('/dashboard', 'HomeController@user')->name('user.dashboard');
 | 
			
		||||
	Route::get('/logout', 'Auth\LoginController@logout')->name('user.logout');
 | 
			
		||||
    Route::resource('/invoices', 'InvoiceController'); // name = (invoices. index / create / show / update / destroy / edit
 | 
			
		||||
    Route::get('/settings', 'SettingsController@index')->name('user.settings');
 | 
			
		||||
});
 | 
			
		||||
	Route::get('dashboard', 'HomeController@user')->name('user.dashboard');
 | 
			
		||||
	Route::get('logout', 'Auth\LoginController@logout')->name('user.logout');
 | 
			
		||||
    Route::resource('invoices', 'InvoiceController'); // name = (invoices. index / create / show / update / destroy / edit
 | 
			
		||||
    Route::get('settings', 'SettingsController@index')->name('user.settings');
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
/*
 | 
			
		||||
 * Inbound routes requiring DB Lookup
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
Authenticated Contact Routes
 | 
			
		||||
@ -60,6 +47,6 @@ Authenticated Contact Routes
 | 
			
		||||
Route::group(['prefix' => 'contact',  'middleware' => 'auth:contact'], function () {
 | 
			
		||||
 | 
			
		||||
   Route::get('/', 'ContactController@index')->name('contact.dashboard');
 | 
			
		||||
   Route::get('logout/', 'Auth\ContactLoginController@logout')->name('contact.logout');
 | 
			
		||||
   Route::get('logout', 'Auth\ContactLoginController@logout')->name('contact.logout');
 | 
			
		||||
   
 | 
			
		||||
}); 
 | 
			
		||||
@ -39,7 +39,8 @@ class MultiDBUserTest extends TestCase
 | 
			
		||||
            'password'          => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
 | 
			
		||||
            'remember_token'    => str_random(10),
 | 
			
		||||
            'email'             => 'db1@example.com',
 | 
			
		||||
            'oauth_user_id'        => '123'
 | 
			
		||||
            'oauth_user_id'     => '123',
 | 
			
		||||
            'db'                => config('database.default')
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -51,7 +52,9 @@ class MultiDBUserTest extends TestCase
 | 
			
		||||
            'password'          => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
 | 
			
		||||
            'remember_token'    => str_random(10),
 | 
			
		||||
            'email'             => 'db2@example.com',
 | 
			
		||||
            'oauth_user_id'     => 'abc'
 | 
			
		||||
            'oauth_user_id'     => 'abc',
 | 
			
		||||
            'db'                => config('database.default')
 | 
			
		||||
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        User::on('db-ninja-1')->create($user);
 | 
			
		||||
 | 
			
		||||
@ -37,6 +37,8 @@ class UniqueEmailTest extends TestCase
 | 
			
		||||
            'first_name'    => 'user_db_1',
 | 
			
		||||
            'email'         => 'user@example.com',
 | 
			
		||||
            'password'      => Hash::make('password'),
 | 
			
		||||
            'db'            => config('database.default')
 | 
			
		||||
 | 
			
		||||
        ];
 | 
			
		||||
 | 
			
		||||
        User::on('db-ninja-1')->create($user);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user