diff --git a/app/Http/Controllers/AccountController.php b/app/Http/Controllers/AccountController.php index 86c43c5ab640..b57fad5e0660 100644 --- a/app/Http/Controllers/AccountController.php +++ b/app/Http/Controllers/AccountController.php @@ -1,7 +1,6 @@ account; $account->forceDelete(); - Confide::logout(); + Auth::logout(); return Redirect::to('/')->with('clearGuestKey', true); } diff --git a/app/Http/Controllers/AppController.php b/app/Http/Controllers/AppController.php index 2d3a3c3a3aca..7f311d75a597 100644 --- a/app/Http/Controllers/AppController.php +++ b/app/Http/Controllers/AppController.php @@ -94,28 +94,17 @@ class AppController extends BaseController // Artisan::call('migrate:rollback', array('--force' => true)); // Debug Purposes Artisan::call('migrate', array('--force' => true)); Artisan::call('db:seed', array('--force' => true)); - - $account = $this->accountRepo->create(); - - // Create User - $user = new User; - $user->first_name = trim(Input::get('first_name')); - $user->last_name = trim(Input::get('last_name')); - $user->email = trim(strtolower(Input::get('email'))); - // Username getting the error: "The username may only contain letters, numbers, and dashes." - // Not sure where this validation comes from? - $user->username = 'test'; //$user->email; + $firstName = trim(Input::get('first_name')); + $lastName = trim(Input::get('last_name')); + $email = trim(strtolower(Input::get('email'))); + $password = trim(Input::get('password')); + $account = $this->accountRepo->create($firstName, $lastName, $email, $password); + $user = $account->users()->first(); - $user->password = trim(Input::get('password')); - $user->password_confirmation = trim(Input::get('password')); - $user->registered = true; - $user->account()->associate($account); - $user->save(); + //Auth::login($user, true); - Auth::login($user, true); - - return Redirect::to('/dashboard'); + return Redirect::to('/login'); } private function testDatabase($database) diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php index 4ad5c58a1a24..f42f483a4701 100644 --- a/app/Http/Controllers/Auth/AuthController.php +++ b/app/Http/Controllers/Auth/AuthController.php @@ -20,6 +20,9 @@ class AuthController extends Controller { use AuthenticatesAndRegistersUsers; + protected $loginPath = '/login'; + protected $redirectTo = '/dashboard'; + /** * Create a new authentication controller instance. * diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php index 0c0c8b4678ff..e325136c1b90 100644 --- a/app/Http/Controllers/UserController.php +++ b/app/Http/Controllers/UserController.php @@ -1,7 +1,6 @@ with('error', $err_msg); } } + */ /** * Attempt to confirm account with code * * @param string $code */ + /* public function confirm($code) { if (Confide::confirm($code)) { @@ -348,20 +352,24 @@ class UserController extends BaseController return Redirect::action('UserController@login')->with('error', $error_msg); } } + */ /** * Displays the forgot password form * */ + /* public function forgot_password() { return View::make(Config::get('confide.forgot_password_form')); } + */ /** * Attempt to send change password link to the given email * */ + /* public function do_forgot_password() { Confide::forgotPassword(Input::get('email')); @@ -371,21 +379,25 @@ class UserController extends BaseController return Redirect::action('UserController@login') ->with('message', $notice_msg); } + */ /** * Shows the change password form with the given token * */ + /* public function reset_password($token = false) { return View::make(Config::get('confide::reset_password_form')) ->with('token', $token); } + */ /** * Attempt change password of the user * */ + /* public function do_reset_password() { if (Auth::check()) { @@ -428,6 +440,7 @@ class UserController extends BaseController } } } + */ /** * Log the user out of the application. @@ -445,7 +458,7 @@ class UserController extends BaseController Session::forget('news_feed_id'); Session::forget('news_feed_message'); - Confide::logout(); + Auth::logout(); return Redirect::to('/')->with('clearGuestKey', true); } diff --git a/app/Http/Middleware/RedirectIfAuthenticated.php b/app/Http/Middleware/RedirectIfAuthenticated.php index dd5a86727bc6..db688181ff87 100644 --- a/app/Http/Middleware/RedirectIfAuthenticated.php +++ b/app/Http/Middleware/RedirectIfAuthenticated.php @@ -35,7 +35,7 @@ class RedirectIfAuthenticated { { if ($this->auth->check()) { - return new RedirectResponse(url('/home')); + return new RedirectResponse(url('/')); } return $next($request); diff --git a/app/Http/routes.php b/app/Http/routes.php index 64a08a67e77c..0675fbe21180 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -54,6 +54,22 @@ Route::get('claim_license', 'PaymentController@claim_license'); Route::post('signup/validate', 'AccountController@checkEmail'); Route::post('signup/submit', 'AccountController@submitSignup'); + +// Laravel auth routes +Route::controllers([ + 'auth' => 'Auth\AuthController', + 'password' => 'Auth\PasswordController', +]); + +get('/signup', array('as' => 'signup', 'uses' => 'Auth\AuthController@getRegister')); +post('/signup', array('as' => 'signup', 'uses' => 'Auth\AuthController@postRegister')); +get('/login', array('as' => 'login', 'uses' => 'Auth\AuthController@getLogin')); +post('/login', array('as' => 'login', 'uses' => 'Auth\AuthController@postLogin')); +get('/logout', array('as' => 'logout', 'uses' => 'Auth\AuthController@getLogout')); +get('/forgot', array('as' => 'forgot', 'uses' => 'Auth\AuthController@getLogin')); +post('/forgot', array('as' => 'forgot', 'uses' => 'Auth\AuthController@postLogin')); + +/* // Confide routes Route::get('login', 'UserController@login'); Route::post('login', 'UserController@do_login'); @@ -63,6 +79,7 @@ Route::post('forgot_password', 'UserController@do_forgot_password'); Route::get('user/reset/{token?}', 'UserController@reset_password'); Route::post('user/reset', 'UserController@do_reset_password'); Route::get('logout', 'UserController@logout'); +*/ if (\App\Libraries\Utils::isNinja()) { Route::post('/signup/register', 'AccountController@doRegister'); diff --git a/app/Models/User.php b/app/Models/User.php index 30b76ccd6533..983b8cde19ba 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -1,15 +1,15 @@ ip = Request::getClientIp(); @@ -32,16 +32,21 @@ class AccountRepository $account->save(); - /* $random = str_random(RANDOM_KEY_LENGTH); - - // I don't like how this is done with regards to init setup. I think it needs a refresh. $user = new User(); - $user->password = $random; - $user->password_confirmation = $random; - $user->email = 'test@test.com'; - $user->username = $random; + if (!$firstName && !$lastName && !$email && !$password) { + $user->password = str_random(RANDOM_KEY_LENGTH); + $user->email = $user->username = str_random(RANDOM_KEY_LENGTH); + } else { + $user->first_name = $firstName; + $user->last_name = $lastName; + $user->email = $user->username = $email; + $user->password = bcrypt($password); + } + $user->confirmed = !Utils::isNinja(); - $account->users()->save($user, []);*/ + $user->registered = !Utils::isNinja(); + + $account->users()->save($user); return $account; } diff --git a/composer.json b/composer.json index e5029284f7c1..356c6648e7b1 100644 --- a/composer.json +++ b/composer.json @@ -13,35 +13,8 @@ "email": "jeramy.n.simpson@gmail.com" } ], - "repositories": [ - { - "type": "package", - "package": { - "name": "calvinfroedge/PHP-Payments", - "version": "dev-master", - "source": { - "url": "https://github.com/calvinfroedge/PHP-Payments", - "type": "git", - "reference": "origin/master" - } - } - }, - { - "type": "package", - "package": { - "name": "impleri/confide", - "version": "dev-master", - "source": { - "url": "https://github.com/impleri/confide", - "type": "git", - "reference": "origin/master" - } - } - } - ], "require": { "laravel/framework": "5.0.*", - "impleri/confide": "dev-master", "patricktalmadge/bootstrapper": "5.5.x", "anahkiasen/former": "4.0.*@dev", "barryvdh/laravel-debugbar": "~2.0.2", @@ -75,8 +48,6 @@ "app/Models", "app/Ninja", "app/Ninja/Repositories", - "vendor/calvinfroedge/PHP-Payments/lib", - "vendor/impleri/confide/src", "database" ], "psr-4": { diff --git a/composer.lock b/composer.lock index 27bc81075ef9..b157ee312727 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "016ceb374b7f3029826cdcf32ce6b1bf", + "hash": "97252a7d44a5d0588faa1b3a3c4888d3", "packages": [ { "name": "alfaproject/omnipay-neteller", @@ -346,12 +346,12 @@ "source": { "type": "git", "url": "https://github.com/Chumper/Datatable.git", - "reference": "3b251b9c6d7d266d6af37d3096034cf69c6b50a8" + "reference": "899f5530f98f766eca3a66afba9127ddf239d5c1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Chumper/Datatable/zipball/3b251b9c6d7d266d6af37d3096034cf69c6b50a8", - "reference": "3b251b9c6d7d266d6af37d3096034cf69c6b50a8", + "url": "https://api.github.com/repos/Chumper/Datatable/zipball/899f5530f98f766eca3a66afba9127ddf239d5c1", + "reference": "899f5530f98f766eca3a66afba9127ddf239d5c1", "shasum": "" }, "require": { @@ -391,7 +391,7 @@ "jquery", "laravel" ], - "time": "2015-03-08 23:17:58" + "time": "2015-03-27 12:52:09" }, { "name": "classpreloader/classpreloader", @@ -1491,17 +1491,6 @@ ], "time": "2015-01-01 16:31:18" }, - { - "name": "impleri/confide", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/impleri/confide", - "reference": "origin/master" - }, - "type": "library", - "time": "2015-03-18 03:04:38" - }, { "name": "intervention/image", "version": "dev-master", @@ -1786,16 +1775,16 @@ }, { "name": "laravel/framework", - "version": "v5.0.20", + "version": "v5.0.23", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "419d3f485ce7946cace4325ef19a30e1d5543951" + "reference": "59219f7afb60be05d74ce01fcb5d2440f7a1b13d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/419d3f485ce7946cace4325ef19a30e1d5543951", - "reference": "419d3f485ce7946cace4325ef19a30e1d5543951", + "url": "https://api.github.com/repos/laravel/framework/zipball/59219f7afb60be05d74ce01fcb5d2440f7a1b13d", + "reference": "59219f7afb60be05d74ce01fcb5d2440f7a1b13d", "shasum": "" }, "require": { @@ -1908,7 +1897,7 @@ "framework", "laravel" ], - "time": "2015-03-24 13:36:37" + "time": "2015-03-28 16:56:59" }, { "name": "league/flysystem", @@ -4181,16 +4170,16 @@ }, { "name": "psy/psysh", - "version": "v0.4.3", + "version": "v0.4.4", "source": { "type": "git", "url": "https://github.com/bobthecow/psysh.git", - "reference": "b5dd7660c0ef38e96cd8cd8fa924b6be0e53906a" + "reference": "489816db71649bd95b416e3ed9062d40528ab0ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bobthecow/psysh/zipball/b5dd7660c0ef38e96cd8cd8fa924b6be0e53906a", - "reference": "b5dd7660c0ef38e96cd8cd8fa924b6be0e53906a", + "url": "https://api.github.com/repos/bobthecow/psysh/zipball/489816db71649bd95b416e3ed9062d40528ab0ac", + "reference": "489816db71649bd95b416e3ed9062d40528ab0ac", "shasum": "" }, "require": { @@ -4248,7 +4237,7 @@ "interactive", "shell" ], - "time": "2015-03-17 15:17:33" + "time": "2015-03-26 18:43:54" }, { "name": "swiftmailer/swiftmailer", @@ -5387,21 +5376,22 @@ }, { "name": "phpspec/prophecy", - "version": "v1.3.1", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9" + "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/9ca52329bcdd1500de24427542577ebf3fc2f1c9", - "reference": "9ca52329bcdd1500de24427542577ebf3fc2f1c9", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", + "reference": "8724cd239f8ef4c046f55a3b18b4d91cc7f3e4c5", "shasum": "" }, "require": { - "doctrine/instantiator": "~1.0,>=1.0.2", - "phpdocumentor/reflection-docblock": "~2.0" + "doctrine/instantiator": "^1.0.2", + "phpdocumentor/reflection-docblock": "~2.0", + "sebastian/comparator": "~1.1" }, "require-dev": { "phpspec/phpspec": "~2.0" @@ -5409,7 +5399,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.4.x-dev" } }, "autoload": { @@ -5433,7 +5423,7 @@ } ], "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "http://phpspec.org", + "homepage": "https://github.com/phpspec/prophecy", "keywords": [ "Double", "Dummy", @@ -5442,7 +5432,7 @@ "spy", "stub" ], - "time": "2014-11-17 16:23:49" + "time": "2015-03-27 19:31:25" }, { "name": "phpunit/php-code-coverage", @@ -5690,16 +5680,16 @@ }, { "name": "phpunit/phpunit", - "version": "4.5.0", + "version": "4.5.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5" + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5b578d3865a9128b9c209b011fda6539ec06e7a5", - "reference": "5b578d3865a9128b9c209b011fda6539ec06e7a5", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d6429b0995b24a2d9dfe5587ee3a7071c1161af4", + "reference": "d6429b0995b24a2d9dfe5587ee3a7071c1161af4", "shasum": "" }, "require": { @@ -5709,8 +5699,8 @@ "ext-reflection": "*", "ext-spl": "*", "php": ">=5.3.3", - "phpspec/prophecy": "~1.3.1", - "phpunit/php-code-coverage": "~2.0", + "phpspec/prophecy": "~1.3,>=1.3.1", + "phpunit/php-code-coverage": "~2.0,>=2.0.11", "phpunit/php-file-iterator": "~1.3.2", "phpunit/php-text-template": "~1.2", "phpunit/php-timer": "~1.0.2", @@ -5758,7 +5748,7 @@ "testing", "xunit" ], - "time": "2015-02-05 15:51:19" + "time": "2015-03-29 09:24:05" }, { "name": "phpunit/phpunit-mock-objects", @@ -6240,7 +6230,6 @@ "aliases": [], "minimum-stability": "stable", "stability-flags": { - "impleri/confide": 20, "anahkiasen/former": 20, "chumper/datatable": 20, "intervention/image": 20, diff --git a/config/app.php b/config/app.php index 7a34a3a3e5a5..a087311915ec 100644 --- a/config/app.php +++ b/config/app.php @@ -139,8 +139,6 @@ return [ /* * Additional Providers */ - 'Zizaco\Confide\ServiceProvider', // Confide to be replaced - 'Bootstrapper\BootstrapperL5ServiceProvider', 'Former\FormerServiceProvider', 'Barryvdh\Debugbar\ServiceProvider', @@ -280,7 +278,6 @@ return [ 'Countries' => 'Webpatser\Countries\CountriesFacade', 'Carbon' => 'Carbon\Carbon', 'Rocketeer' => 'Rocketeer\Facades\Rocketeer', - 'Confide' => 'Zizaco\Confide\Facade',// Confide to be replaced ], diff --git a/resources/views/auth/login.blade.php b/resources/views/auth/login.blade.php new file mode 100644 index 000000000000..cd5993158e7d --- /dev/null +++ b/resources/views/auth/login.blade.php @@ -0,0 +1,125 @@ +@extends('master') + +@section('head') + + + + + + +@endsection + +@section('body') +
+ {!! Former::text('email')->placeholder(trans('texts.email_address'))->raw() !!} + {!! Former::password('password')->placeholder(trans('texts.password'))->raw() !!} +
+ +{!! Button::primary(trans('texts.lets_go'))->withAttributes(array('class' => 'btn-lg'))->submit()->block() !!}
+ ++ {!! link_to('forgot_password', trans('texts.forgot_password')) !!} +
+ + + @if (count($errors->all())) +