diff --git a/app/controllers/SessionController.php b/app/controllers/SessionController.php index 297c65d..d85b5d6 100644 --- a/app/controllers/SessionController.php +++ b/app/controllers/SessionController.php @@ -8,6 +8,13 @@ class SessionController extends \BaseController return View::make('login'); } + public function doLogout() + { + Auth::logout(); + return Redirect::to('login'); + Session::forget('user'); + } + public function doLogin() { $rules = array( @@ -35,7 +42,7 @@ class SessionController extends \BaseController if (Auth::attempt($userdata, true)) { - return \Redirect::to('/'); + return \Redirect::intended('/'); } else { @@ -47,7 +54,7 @@ class SessionController extends \BaseController if (Auth::attempt($userdata)) { - return \Redirect::to('/'); + return \Redirect::intended('/'); } else { @@ -61,10 +68,4 @@ class SessionController extends \BaseController } - public function doLogout() - { - \Auth::logout(); - return \Redirect::to('/'); - } - } \ No newline at end of file diff --git a/app/database/migrations/2014_06_29_015251_alter_user_table_replace_column.php b/app/database/migrations/2014_06_29_015251_alter_user_table_replace_column.php new file mode 100644 index 0000000..6738917 --- /dev/null +++ b/app/database/migrations/2014_06_29_015251_alter_user_table_replace_column.php @@ -0,0 +1,35 @@ +dropColumn('remember_token'); + }); + + Schema::table('users', function(Blueprint $table) + { + $table->text('remember_token', 100)->nullable()->after('password'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + } + +} diff --git a/app/database/seeds/DatabaseSeeder.php b/app/database/seeds/DatabaseSeeder.php index ffc5700..825bad8 100755 --- a/app/database/seeds/DatabaseSeeder.php +++ b/app/database/seeds/DatabaseSeeder.php @@ -10,8 +10,7 @@ class DatabaseSeeder extends Seeder { public function run() { Eloquent::unguard(); - - $this->call('UserTableSeeder'); + $this->call('RoleTableSeeder'); } diff --git a/app/database/seeds/UserTableSeeder.php b/app/database/seeds/UserTableSeeder.php deleted file mode 100644 index 53b0b94..0000000 --- a/app/database/seeds/UserTableSeeder.php +++ /dev/null @@ -1,16 +0,0 @@ -delete(); - - User::create(array( - 'first' => 'Elisha', - 'last' => 'Chirchir', - 'email' => 'elisha.java@gmail.com', - 'password' => Hash::make('admin') - )); - } -} \ No newline at end of file diff --git a/app/routes.php b/app/routes.php index 576e54f..6047670 100755 --- a/app/routes.php +++ b/app/routes.php @@ -17,20 +17,24 @@ Route::get('/', function(){return View::make('home') ;}); Route::get('login', array('as' => 'login', 'uses' => 'SessionController@showLogin')); Route::post('login', array('uses' => 'SessionController@doLogin')); -Route::post('logout', array('uses' => 'SessionController@doLogout')); /** * New User Creation Controller routes */ Route::get('users/create', array('as' => 'create', 'uses' => 'UserController@create')); Route::post('users/store', array('uses' => 'UserController@store')); -Route::get('users/group/{user_id}', array('as' => 'group', 'uses' => 'UserController@chooseGroup')); -Route::get('users/group/{user_id}/{group_id}', array('as' => 'complete', 'uses' => 'UserController@completeRegistration')); -Route::post('users/group/complete', array('uses' => 'UserController@saveProfile')); -Route::get('users/{id}', array('as' => 'users', 'uses' => 'UserController@showProfile')); -Route::get('users', array('as' => 'users', 'uses' => 'UserController@index')); -Route::get('mentors', array('as' => 'mentors', 'uses' => 'UserController@mentors')); -Route::get('mentees', array('as' => 'mentees', 'uses' => 'UserController@mentees')); + +Route::group(array('before' => 'auth'), function() +{ + Route::get('logout', array('uses' => 'SessionController@doLogout')); + Route::get('users/group/{user_id}', array('as' => 'group', 'uses' => 'UserController@chooseGroup')); + Route::get('users/group/{user_id}/{group_id}', array('as' => 'complete', 'uses' => 'UserController@completeRegistration')); + Route::post('users/group/complete', array('uses' => 'UserController@saveProfile')); + Route::get('users/{id}', array('as' => 'users', 'uses' => 'UserController@showProfile')); + Route::get('users', array('as' => 'users', 'uses' => 'UserController@index')); + Route::get('mentors', array('as' => 'mentors', 'uses' => 'UserController@mentors')); + Route::get('mentees', array('as' => 'mentees', 'uses' => 'UserController@mentees')); +}); /** * User Password Reminder Controller routes @@ -39,3 +43,5 @@ Route::get('password/remind', array('as' => 'remind', 'uses' => 'RemindersContro Route::post('password/remind', array('uses' => 'RemindersController@postRemind')); Route::get('password/reset/{token}', array('uses' => 'RemindersController@getReset')); Route::post('password/reset', array('uses' => 'RemindersController@postReset')); + + diff --git a/public/images/users/profile_53af7620e4408.JPG b/public/images/users/profile_53af7620e4408.JPG new file mode 100644 index 0000000..52af230 Binary files /dev/null and b/public/images/users/profile_53af7620e4408.JPG differ diff --git a/vendor/autoload.php b/vendor/autoload.php index 5a47322..66d1532 100755 --- a/vendor/autoload.php +++ b/vendor/autoload.php @@ -4,4 +4,4 @@ require_once __DIR__ . '/composer' . '/autoload_real.php'; -return ComposerAutoloaderInit26a4f56b6ff7cf8a0ccdad2c8bd1b12a::getLoader(); +return ComposerAutoloaderInit69afc0859650b22d5bb9498e188d277d::getLoader(); diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index d024ebe..23519a4 100755 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -7,6 +7,7 @@ $baseDir = dirname($vendorDir); return array( 'AlterUserTableAddColumns' => $baseDir . '/app/database/migrations/2014_06_28_024032_alter_user_table_add_columns.php', + 'AlterUserTableReplaceColumn' => $baseDir . '/app/database/migrations/2014_06_29_015251_alter_user_table_replace_column.php', 'BaseController' => $baseDir . '/app/controllers/BaseController.php', 'Boris\\Boris' => $vendorDir . '/d11wtq/boris/lib/Boris/Boris.php', 'Boris\\CLIOptionsHandler' => $vendorDir . '/d11wtq/boris/lib/Boris/CLIOptionsHandler.php', diff --git a/vendor/composer/autoload_real.php b/vendor/composer/autoload_real.php index 2ad283f..fb801f8 100755 --- a/vendor/composer/autoload_real.php +++ b/vendor/composer/autoload_real.php @@ -2,7 +2,7 @@ // autoload_real.php @generated by Composer -class ComposerAutoloaderInit26a4f56b6ff7cf8a0ccdad2c8bd1b12a +class ComposerAutoloaderInit69afc0859650b22d5bb9498e188d277d { private static $loader; @@ -19,9 +19,9 @@ class ComposerAutoloaderInit26a4f56b6ff7cf8a0ccdad2c8bd1b12a return self::$loader; } - spl_autoload_register(array('ComposerAutoloaderInit26a4f56b6ff7cf8a0ccdad2c8bd1b12a', 'loadClassLoader'), true, true); + spl_autoload_register(array('ComposerAutoloaderInit69afc0859650b22d5bb9498e188d277d', 'loadClassLoader'), true, true); self::$loader = $loader = new \Composer\Autoload\ClassLoader(); - spl_autoload_unregister(array('ComposerAutoloaderInit26a4f56b6ff7cf8a0ccdad2c8bd1b12a', 'loadClassLoader')); + spl_autoload_unregister(array('ComposerAutoloaderInit69afc0859650b22d5bb9498e188d277d', 'loadClassLoader')); $vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); @@ -49,14 +49,14 @@ class ComposerAutoloaderInit26a4f56b6ff7cf8a0ccdad2c8bd1b12a $includeFiles = require __DIR__ . '/autoload_files.php'; foreach ($includeFiles as $file) { - composerRequire26a4f56b6ff7cf8a0ccdad2c8bd1b12a($file); + composerRequire69afc0859650b22d5bb9498e188d277d($file); } return $loader; } } -function composerRequire26a4f56b6ff7cf8a0ccdad2c8bd1b12a($file) +function composerRequire69afc0859650b22d5bb9498e188d277d($file) { require $file; }