mentors

mentors Commit Details


Date:2014-06-29 22:41:46 (10 years 5 months ago)
Author:Right Or Wrong
Branch:develop
Commit:b2ff5abcaec72b58b7e47e8dfba5a809ce5b6386
Parents: 2da52c5f2456822bd5ee425b316f31ea893c2e38
Message:session handling and redirecting users based on whether they are logged in or not

Changes:

File differences

app/controllers/AdminController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
/**
* This is the controller that manages the Admin interface of Mentconnect
*/
class AdminController extends \BaseController
{
public function __construct()
{
$this->beforeFilter('auth');
}
public function home()
{
return View::make('login');
}
public function manageUsers()
{
}
public function viewUser($id)
{
}
public function destroyUser($id)
{
}
public function restoreUser($id)
{
}
public function viewStats()
{
}
public function showContact($id)
{
}
public function contactUser($id)
{
}
public function revokeAccess($id)
{
}
public function showMatches()
{
}
}
app/controllers/HomeController.php
1515
1616
1717
18
18
1919
20
21
22
23
24
2025
2126
2227
|
*/
public function showWelcome()
public function index()
{
if(Auth::check())
{
return Redirect::route('user', Auth::id());
}
return View::make('home');
}
app/controllers/SessionController.php
55
66
77
8
9
10
11
12
813
914
1015
11
12
13
14
15
16
17
1816
1917
2018
......
6866
6967
7068
69
70
71
72
73
74
75
7176
public function showLogin()
{
if(Auth::check())
{
return Redirect::route('user', Auth::id());
}
return View::make('login');
}
public function doLogout()
{
Auth::logout();
return Redirect::to('login');
Session::forget('user');
}
public function doLogin()
{
$rules = array(
}
public function doLogout()
{
Auth::logout();
return Redirect::to('login');
Session::forget('user');
}
}
app/controllers/UserController.php
44
55
66
7
87
98
109
......
3938
4039
4140
41
4242
4343
4444
......
182182
183183
184184
185
185
186186
187187
188188
......
223223
224224
225225
226
226
227227
228228
229229
class UserController extends \BaseController
{
public function index()
{
$users = User::all();
array('first' => Input::get('first'),
'last' => Input::get('last'),
'email' => Input::get('email'),
'level' => 'user',
'password' => Hash::make(\Input::get('password'))));
if($user->save())
if ($user->save())
{
return Redirect::route('users', array($user_id));
return Redirect::route('user', array($user_id));
}else
{
\Redirect::back('complete', array($user_id, $group_id ));
$user = User::find($id);
\Session::flash('message', 'You have successfully updated your profile.');
return Redirect::to('users', array($id));
return Redirect::to('user', array($id));
}
}
app/database/migrations/2014_06_29_233811_alter_user_table_add_admin_column.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterUserTableAddAdminColumn extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('users', function(Blueprint $table)
{
$table->string('level', 32)->after('remember_token');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('users', function(Blueprint $table)
{
$table->dropColumn('level');
});
}
}
app/filters.php
7878
7979
8080
81
82
83
84
85
86
87
88
89
90
91
92
throw new Illuminate\Session\TokenMismatchException;
}
});
Route::filter('admin', function()
{
if(Auth::check() && Auth::user()->level != 'admin')
{
\Session::flash('message', 'You tried to access restricted area!');
return Redirect::to('denied');
}
});
Route::when('admin/*', 'admin');
app/models/User.php
1414
1515
1616
17
17
1818
1919
2020
......
6767
6868
6969
70
71
72
73
74
7075
protected $table = 'users';
protected $fillable = array(
'first', 'last', 'email', 'password', 'location', 'skills', 'photo', 'bio', 'remember_token');
'first', 'last', 'email', 'password', 'location', 'skills', 'photo', 'bio', 'remember_token', 'level');
/**
* The attributes excluded from the model's JSON form.
{
return 'remember_token';
}
public function getFullName()
{
return $this->first. ' ' . $this->last;
}
}
app/routes.php
1414
1515
1616
17
17
1818
1919
2020
......
3030
3131
3232
33
33
3434
3535
3636
......
4646
4747
4848
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
4971
/**
* User Session Controller routes
*/
Route::get('/', function(){return View::make('home') ;});
Route::get('/', array('as' => 'home', 'uses' => 'HomeController@index'));
Route::get('login', array('as' => 'login', 'uses' => 'SessionController@showLogin'));
Route::post('login', array('uses' => 'SessionController@doLogin'));
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('user/{id}', array('as' => 'user', 'uses' => 'UserController@showProfile'));
Route::get('users/{id}/edit', array('as' => 'edit', 'uses' => 'UserController@edit'));
Route::put('users/{id}/update', array('uses' => 'UserController@update'));
Route::get('users', array('as' => 'users', 'uses' => 'UserController@index'));
Route::get('password/reset/{token}', array('uses' => 'RemindersController@getReset'));
Route::post('password/reset', array('uses' => 'RemindersController@postReset'));
/**
* Admin Routes ++ Management Stuff out of reach for regular users
*/
Route::group(array('before' => 'auth|admin'), function()
{
Route::get('admin', array('as' => 'admin', 'uses' => 'AdminController@home'));
Route::get('admin/users', array('as' => 'all', 'uses' => 'AdminController@manageUsers'));
Route::get('admin/user/{id}', array('as' => 'userx', 'uses' => 'AdminController@viewUser'));
Route::delete('admin/user/{id}', array('uses' => 'AdminController@destroyUser'));
Route::post('admin/user/restore/{id}', array('uses' => 'AdminController@restoreUser'));
Route::get('admin/user/stats', array('as' => 'stats', 'uses' => 'AdminController@viewStats'));
Route::get('admin/user/contact/{id}', array('as' => 'contact', 'uses' => 'AdminController@showContact'));
Route::post('admin/user/contact', array('uses' => 'AdminController@contactUser'));
Route::post('admin/user/revoke', array('uses' => 'AdminController@revokeAccess'));
Route::get('admin/users/matches', array('as' => 'matches', 'uses' => 'AdminController@showMatches'));
});
Route::get('denied', function()
{
return View::make('404');
});
app/views/404.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE <!DOCTYPE html>
<html>
<head>
<title>403 Forbidden - Mentconnect</title>
{{HTML::style('css/mentconnect.css')}}
{{HTML::style('css/denied.css') }}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
</head>
<body>
<header id="cta" class="background-showcase">
<div id="nv" class="navbar">
<div class="container">
<a class="navbar-brand" href="/">
<div class="asset logo-white-header">
{{ HTML::image("images/mentconnect.png", "editor", array("width" => "130px", "height" => "44px")) }}
</div>
</a>
<ul class=" nav navbar-nav pull-right">
<li class>
{{HTML::link('partners', 'Partners') }}
</li>
<li class>
{{HTML::link('blog', 'Blog') }}
</li>
<li class="button">
{{HTML::link('login', 'Sign In') }}
</li>
</ul>
</div>
</div>
</header>
<div class="container">
<div class="row">
<div class="span12">
<div class="jumbotron center">
<h1>Access Denied <small><font face="Tahoma" color="red">Error 403</font></small></h1>
<br />
<p>Apparently you tried accessing a restricted area and the gods were not very pleased. Please press the <b>Back</b> button to navigate back to where you were, </p>
<p><b>Or you could just press this neat little button:</b></p>
<a href="/" class="btn btn-large btn-info"><i class="icon-home icon-white"></i> Take Me Home</a>
</div>
<br />
</div>
</div>
</div>
<div id="footer">
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p id="copyright-section">
Copyright &copy; 2014. All Rights Reserved.
</p>
</div>
<div class="col-lg-4">
{{HTML::image('images/mentconnect.png', "logo", array('width' => '140px', 'height' => '50px'))}}
</div>
<div class="col-lg-4">
<p id="love">
Built With Laravel + Bootstrap Frameworks by Elisha Chirchir.
</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
app/views/login.blade.php
44
55
66
7
78
89
910
<meta charset="UTF-8">
<title>Mentconnect - Login</title>
{{HTML::style('css/mentconnect.css')}}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
</head>
<body>
<header id="cta" class="background-showcase">
app/views/users/choice.blade.php
44
55
66
7
78
89
910
<meta charset="UTF-8">
<title>Mentconnect Inc - Profile</title>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
{{HTML::style('css/mentconnect.css')}}
</head>
<body>
app/views/users/complete.blade.php
44
55
66
7
78
89
910
<meta charset="UTF-8">
<title>Mentconnect Inc</title>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
{{HTML::style('css/mentconnect.css')}}
</head>
<body>
app/views/users/create.blade.php
44
55
66
7
78
89
910
<meta charset="UTF-8">
<title>Mentconnect Inc</title>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
{{HTML::style('css/mentconnect.css')}}
</head>
<body>
app/views/users/group.blade.php
44
55
66
7
78
89
910
<meta charset="UTF-8">
<title>Mentconnect Inc - Profile</title>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
{{HTML::style('css/mentconnect.css')}}
</head>
<body>
app/views/users/index.blade.php
44
55
66
7
78
9
810
911
1012
......
7476
7577
7678
77
78
79
80
81
82
83
84
79
80
81
82
83
84
85
86
87
8588
86
87
88
89
90
91
8992
90
91
92
93
94
95
96
97
93
94
95
96
97
98
99
100
101
98102
99103
<meta charset="UTF-8">
<title>Users - mentconnect inc</title>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
{{HTML::style('css/mentconnect.css')}}
{{HTML::style('css/denied.css')}}
</head>
<body>
<header id="cta" class="background-showcase">
<div class="container padded"></div>
<br /><br />
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p id="copyright-section">
Copyright &copy; 2014. All Rights Reserved.
</p>
</div>
<div id="footer">
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p id="copyright-section">
Copyright &copy; 2014. All Rights Reserved.
</p>
</div>
<div class="col-lg-4">
{{HTML::image('images/mentconnect.png', "logo", array('width' => '140px', 'height' => '50px'))}}
</div>
<div class="col-lg-4">
{{HTML::image('images/mentconnect.png', "logo", array('width' => '140px', 'height' => '50px'))}}
</div>
<div class="col-lg-4">
<p id="love">
Built With Laravel + Bootstrap Frameworks by Elisha Chirchir.
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<p id="love">
Built With Laravel + Bootstrap Frameworks by Elisha Chirchir.
</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
app/views/users/mentees.blade.php
44
55
66
7
78
9
810
911
1012
......
7476
7577
7678
77
78
79
80
81
82
83
84
79
80
81
82
83
84
85
86
87
8588
86
87
88
89
90
91
8992
90
91
92
93
94
95
96
97
93
94
95
96
97
98
99
100
101
98102
99103
<meta charset="UTF-8">
<title>Users - mentconnect inc</title>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
{{HTML::style('css/mentconnect.css')}}
{{HTML::style('css/denied.css')}}
</head>
<body>
<header id="cta" class="background-showcase">
<div class="container padded"></div>
<br /><br />
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p id="copyright-section">
Copyright &copy; 2014. All Rights Reserved.
</p>
</div>
<div id="footer">
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p id="copyright-section">
Copyright &copy; 2014. All Rights Reserved.
</p>
</div>
<div class="col-lg-4">
{{HTML::image('images/mentconnect.png', "logo", array('width' => '140px', 'height' => '50px'))}}
</div>
<div class="col-lg-4">
{{HTML::image('images/mentconnect.png', "logo", array('width' => '140px', 'height' => '50px'))}}
</div>
<div class="col-lg-4">
<p id="love">
Built With Laravel + Bootstrap Frameworks by Elisha Chirchir.
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<p id="love">
Built With Laravel + Bootstrap Frameworks by Elisha Chirchir.
</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
app/views/users/mentors.blade.php
44
55
66
7
78
9
810
911
1012
......
7173
7274
7375
74
75
76
77
78
79
80
81
82
83
84
76
77
78
79
80
81
82
83
84
85
8586
86
87
88
87
88
89
8990
90
91
92
93
94
95
96
97
91
92
93
94
95
96
97
98
99
98100
99101
<meta charset="UTF-8">
<title>Users - mentconnect inc</title>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
{{HTML::style('css/mentconnect.css')}}
{{HTML::style('css/denied.css')}}
</head>
<body>
<header id="cta" class="background-showcase">
</div>
</div>
<div class="container padded"></div>
<br /><br />
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p id="copyright-section">
Copyright &copy; 2014. All Rights Reserved.
</p>
</div>
<div id="footer">
<div id="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-4">
<p id="copyright-section">
Copyright &copy; 2014. All Rights Reserved.
</p>
</div>
<div class="col-lg-4">
{{HTML::image('images/mentconnect.png', "logo", array('width' => '140px', 'height' => '50px'))}}
</div>
<div class="col-lg-4">
{{HTML::image('images/mentconnect.png', "logo", array('width' => '140px', 'height' => '50px'))}}
</div>
<div class="col-lg-4">
<p id="love">
Built With Laravel + Bootstrap Frameworks by Elisha Chirchir.
</p>
</div>
</div>
</div>
</div>
<div class="col-lg-4">
<p id="love">
Built With Laravel + Bootstrap Frameworks by Elisha Chirchir.
</p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
app/views/users/profile.blade.php
88
99
1010
11
1112
1213
1314
......
5051
5152
5253
53
54
54
55
5556
56
57
5758
5859
5960
......
8283
8384
8485
85
86
8687
8788
8889
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/css/bootstrap.min.css" rel="stylesheet">
{{HTML::style('css/userprofile.css')}}
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css">
<script src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.1.0/js/bootstrap.min.js"></script>
</head>
<div class="col-md-2">
<ul class="nav nav-pills nav-stacked well">
<li class="active"><a href="#"><i class="fa fa-envelope"></i> Compose</a></li>
<li><a href="#"><i class="fa fa-home"></i> Home</a></li>
<li><a href="#"><i class="fa fa-user"></i> Profile</a></li>
<li><a href="/"><i class="fa fa-home"></i> Home</a></li>
<li><a href="/users"><i class="fa fa-user"></i> Profile</a></li>
<li><a href="#"><i class="fa fa-key"></i> Security</a></li>
<li><a href="#"><i class="fa fa-sign-out"></i> Logout</a></li>
<li><a href="/logout"><i class="fa fa-sign-out"></i> Logout</a></li>
</ul>
</div>
<div class="col-md-10">
<div class="btn-group col-md-8"><b>Hi Check this new Bootstrap plugin</b> <div class="pull-right"><i class="glyphicon glyphicon-time"></i> 12:10 PM <button class="btn btn-primary btn-xs" data-toggle="modal" data-target=".bs-example-modal-lg"><i class="fa fa-share-square-o"> Reply</i></button></div> </div>
</div>
</a>
<div id="a1" class="collapse out well">This is the message body1</div>
<div id="a1" class="collapse out well">This is the message body</div>
<br>
<button class="btn btn-primary btn-xs"><i class="fa fa-check-square-o"></i> Delete Checked Item's</button>
</div>
composer.json
44
55
66
7
7
8
89
910
1011
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
"laravel/framework": "4.1.*"
"laravel/framework": "4.1.*",
"zizaco/entrust": "dev-master"
},
"autoload": {
"classmap": [
public/css/denied.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
.center {text-align: center; margin-left: auto; margin-right: auto; margin-bottom: auto; margin-top: auto;}
#container {
min-height:100%;
position:relative;
}
#body {
padding:10px;
padding-bottom:40px;
}
#footer {
position:absolute;
bottom:0;
width:100%;
height:60px;
}
public/css/mentconnect.css
48594859
48604860
48614861
4862
4862
48634863
48644864
48654865
margin-bottom: 60px; }
#footer {
background-color: #444444;
background-color: #fff;
padding: 70px 0px 35px 0px;
color: #FFF;
line-height: 30px; }
vendor/autoload.php
44
55
66
7
7
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit388bc9429cea0a8e4d09dc1c56592c4a::getLoader();
return ComposerAutoloaderInit6d2e6d08a33bae4469244f4d9572f9d4::getLoader();
vendor/composer/autoload_classmap.php
66
77
88
9
910
1011
1112
$baseDir = dirname($vendorDir);
return array(
'AlterUserTableAddAdminColumn' => $baseDir . '/app/database/migrations/2014_06_29_233811_alter_user_table_add_admin_column.php',
'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',
vendor/composer/autoload_real.php
22
33
44
5
5
66
77
88
......
1919
2020
2121
22
22
2323
24
24
2525
2626
2727
......
4949
5050
5151
52
52
5353
5454
5555
5656
5757
5858
59
59
6060
6161
6262
// autoload_real.php @generated by Composer
class ComposerAutoloaderInit388bc9429cea0a8e4d09dc1c56592c4a
class ComposerAutoloaderInit6d2e6d08a33bae4469244f4d9572f9d4
{
private static $loader;
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInit388bc9429cea0a8e4d09dc1c56592c4a', 'loadClassLoader'), true, true);
spl_autoload_register(array('ComposerAutoloaderInit6d2e6d08a33bae4469244f4d9572f9d4', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
spl_autoload_unregister(array('ComposerAutoloaderInit388bc9429cea0a8e4d09dc1c56592c4a', 'loadClassLoader'));
spl_autoload_unregister(array('ComposerAutoloaderInit6d2e6d08a33bae4469244f4d9572f9d4', 'loadClassLoader'));
$vendorDir = dirname(__DIR__);
$baseDir = dirname($vendorDir);
$includeFiles = require __DIR__ . '/autoload_files.php';
foreach ($includeFiles as $file) {
composerRequire388bc9429cea0a8e4d09dc1c56592c4a($file);
composerRequire6d2e6d08a33bae4469244f4d9572f9d4($file);
}
return $loader;
}
}
function composerRequire388bc9429cea0a8e4d09dc1c56592c4a($file)
function composerRequire6d2e6d08a33bae4469244f4d9572f9d4($file)
{
require $file;
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.14252s using 13 queries.