diff --git a/app/controllers/RemindersController.php b/app/controllers/RemindersController.php index 2b47675..0a64f8d 100644 --- a/app/controllers/RemindersController.php +++ b/app/controllers/RemindersController.php @@ -40,8 +40,8 @@ class RemindersController extends Controller { return Redirect::back()->with('error', Lang::get($response)); case Password::REMINDER_SENT: - \Session::flash('message', 'Please check your email for information on how to reset your password.'); - return Redirect::back()->with('status', Lang::get($response)); + \Session::flash('message', 'Please check your email for instructions on how to reset your password'); + return Redirect::to('password/remind'); } } @@ -70,8 +70,7 @@ class RemindersController extends Controller { //validate input here $rules = array( 'email' => 'required|email', - 'password' => 'required|password', - 'password_confirmation' => 'required', + 'password' => 'required|confirmed', 'token' => 'required', ); @@ -100,10 +99,11 @@ class RemindersController extends Controller { case Password::INVALID_PASSWORD: case Password::INVALID_TOKEN: case Password::INVALID_USER: + \Session::flash('message', 'You have to enter the correct information to proceed'); return Redirect::back()->with('error', Lang::get($response)); case Password::PASSWORD_RESET: - echo 'Password was reset successfully'; + \Session::flash('message', 'You can now login with your new credentials.'); return Redirect::to('login'); } } diff --git a/app/controllers/SessionController.php b/app/controllers/SessionController.php index 123a527..297c65d 100644 --- a/app/controllers/SessionController.php +++ b/app/controllers/SessionController.php @@ -17,6 +17,8 @@ class SessionController extends \BaseController $validator = Validator::make(Input::all(), $rules); + $remember = \Input::get('remember'); + if ($validator->fails()) { return Redirect::to('login') ->withErrors($validator) @@ -28,22 +30,35 @@ class SessionController extends \BaseController 'password' => Input::get('password') ); - if (Auth::attempt($userdata)) { + if($remember == 'yes') + { + if (Auth::attempt($userdata, true)) + { + + return \Redirect::to('/'); + + } else { - return \Redirect::to('/'); + return \Redirect::to('login'); - } else { + } + }else + { + if (Auth::attempt($userdata)) + { - return \Redirect::to('login'); + return \Redirect::to('/'); + } else { + + return \Redirect::to('login'); + + } } + } - if (Auth::attempt(array('email' => $email, 'password' => $password), true)) - { - // The user is being remembered... - } } public function doLogout() diff --git a/app/controllers/UserController.php b/app/controllers/UserController.php index 3230253..fbd8a0a 100644 --- a/app/controllers/UserController.php +++ b/app/controllers/UserController.php @@ -86,38 +86,65 @@ class UserController extends \BaseController $skills = array(); - if (Input::get('java') === 'Java'){} + if (Input::get('java') === 'Java') + { array_push($skills, 'Java'); + } - if (Input::get('php') === 'PHP') {} + if (Input::get('php') === 'PHP') + { array_push($skills, 'PHP'); + } - if (Input::get('python') === 'Python') {} + if (Input::get('python') === 'Python') + { array_push($skills, 'Python'); + } - if (Input::get('cplus') === 'Cplus') {} + if (Input::get('cplus') === 'Cplus') + { array_push($skills, 'C++'); + } - if (Input::get('objc') === 'Objc') {} + if (Input::get('objc') === 'Objc') + { array_push($skills, 'Objective C'); + } - if (Input::get('htmljscss') === 'Html') {} + if (Input::get('htmljscss') === 'Html') + { array_push($skills, 'HTML JS CSS'); + } - if (Input::get('android') === 'Android') {} - array_push($skills, 'Android'); - - if (Input::get('ux') === 'UXDesign') {} + if (Input::get('android') === 'Android') + { + array_push($skills, 'Android'); + } + + if (Input::get('ux') === 'UXDesign') + { array_push($skills, 'Java'); + } - if (Input::get('webapps') === 'Webapps') {} + if (Input::get('webapps') === 'Webapps') + { array_push($skills, 'Web Apps'); + } - if (Input::get('ruby') === 'Ruby') {} + if (Input::get('ruby') === 'Ruby') + { array_push($skills, 'Ruby on Rails'); + } - if (Input::get('people') === 'People') {} + if (Input::get('csharp') === 'CSharp') + { + array_push($skills, 'C#'); + } + + if (Input::get('people') === 'People') + { array_push($skills, 'People Skills'); + } $skills = serialize($skills); @@ -128,23 +155,34 @@ class UserController extends \BaseController $user->bio = \Input::get('bio'); $user->skills = $skills; - if (\Input::hasFile('photo')) { + if (\Input::hasFile('photo')) + { $photo = \Input::file('photo'); $filename = uniqid('profile_').'.'.$photo->getClientOriginalExtension(); $photo->move(public_path('images/users'), $filename); $user->photo = 'images/users/'.$filename; } - $role = UserXrefRole::create(array( - 'user_id' => $user_id, - 'role_id' => $group_id - )); + $user_role = UserXrefRole::where('user_id', '=', $user_id)->get(); + + if(count($user_role)) + { + $user_role->user_id = $user_id; + $user_role->role_id = $group_id; + }else + { + $user_role = UserXrefRole::create(array( + 'user_id' => $user_id, + 'role_id' => $group_id + )); + + } - $role->save(); + $user_role->save(); if ($user->save()) { - return Redirect::route('users', array('user_id' => $user_id)); + return Redirect::route('users', array($user_id)); }else { \Redirect::back('complete', array($user_id, $group_id )); diff --git a/app/models/User.php b/app/models/User.php index be2e51c..5b80b15 100755 --- a/app/models/User.php +++ b/app/models/User.php @@ -12,8 +12,9 @@ class User extends Eloquent implements UserInterface, RemindableInterface { * @var string */ protected $table = 'users'; + protected $fillable = array( - 'first', 'last', 'email', 'password', 'location', 'skills', 'photo', 'bio'); + 'first', 'last', 'email', 'password', 'location', 'skills', 'photo', 'bio', 'remember_token'); /** * The attributes excluded from the model's JSON form. @@ -54,16 +55,16 @@ class User extends Eloquent implements UserInterface, RemindableInterface { public function getRememberToken() { - return $this->value; + return $this->remember_token; } public function setRememberToken($value) { - $this->value = $value; + $this->remember_token = $value; } public function getRememberTokenName() { - return $this->name; + return 'remember_token'; } } diff --git a/app/routes.php b/app/routes.php index 233ed17..c8491a4 100755 --- a/app/routes.php +++ b/app/routes.php @@ -33,7 +33,7 @@ Route::get('users', array('as' => 'users', 'uses' => 'UserController@index')); /** * User Password Reminder Controller routes */ -Route::get('password/remind', array('uses' => 'RemindersController@getRemind')); +Route::get('password/remind', array('as' => 'remind', 'uses' => 'RemindersController@getRemind')); Route::post('password/remind', array('uses' => 'RemindersController@postRemind')); Route::get('password/reset/{token}', array('uses' => 'RemindersController@getReset')); -Route::post('password/reset/{token}', array('uses' => 'RemindersController@postReset')); +Route::post('password/reset', array('uses' => 'RemindersController@postReset')); diff --git a/app/views/login.blade.php b/app/views/login.blade.php index 8065a22..99ebd6c 100644 --- a/app/views/login.blade.php +++ b/app/views/login.blade.php @@ -41,7 +41,11 @@

Please Sign In

- + + @if(Session::has('message')) +

{{ Session::get('message') }}

+ @endif +
{{ Form::label('email', 'Email', array('class' => 'control-label')) }}
@@ -56,11 +60,12 @@
- +
+
      {{HTML::link('password/remind', 'Forgot your password?')}} diff --git a/app/views/password/remind.blade.php b/app/views/password/remind.blade.php index 4834561..999140c 100644 --- a/app/views/password/remind.blade.php +++ b/app/views/password/remind.blade.php @@ -42,15 +42,17 @@

Enter Your Email

- - @if(Session::has('message')) + +

{{$errors->first('email')}}

+ + @if(Session::has('message'))

{{ Session::get('message') }}

@endif
{{ Form::label('email', 'Email', array('class' => 'control-label')) }}
- {{ Form::text('email', null, array('class' => 'form-control borderd input-large', 'span' => 'span6', 'placeholder' => 'awesome@awesome.com'))}}

{{$errors->first('email')}}

+ {{ Form::text('email', null, array('class' => 'form-control borderd input-large', 'span' => 'span6', 'placeholder' => 'awesome@awesome.com'))}}
diff --git a/app/views/password/reset.blade.php b/app/views/password/reset.blade.php index ab9ffd0..5256cae 100644 --- a/app/views/password/reset.blade.php +++ b/app/views/password/reset.blade.php @@ -38,7 +38,7 @@
- {{ Form::open(array('url' => 'password/remind', 'class' => 'form-horizontal'))}} + {{ Form::open(array('url' => 'password/reset', 'class' => 'form-horizontal'))}}

Reset Your Password

diff --git a/app/views/users/complete.blade.php b/app/views/users/complete.blade.php index 6342a62..a0dfc43 100644 --- a/app/views/users/complete.blade.php +++ b/app/views/users/complete.blade.php @@ -90,6 +90,9 @@ {{ Form::checkbox('ruby', 'Ruby') }} Ruby + diff --git a/app/views/users/index.blade.php b/app/views/users/index.blade.php index d6fff4e..f0bae2c 100644 --- a/app/views/users/index.blade.php +++ b/app/views/users/index.blade.php @@ -28,71 +28,52 @@
- -
-
-
-

Get Matched With a Mentor - or Be a Mentor To Someone Today.

- -

- Learning to program can be a daunting task - especially if you have no one to help you. It doesn't have to be that way. - That is why I started mentconnect. -

- -

- {{ HTML::link('register', 'Join Now', array('class' => 'btn btn-large btn-primary proxima-bold')) }} -

-
- -
- -
-
-
- +
-

Rethinking the learning process had to be done.

+

Let there be mentors and mentees. Let there be learning!

- Cut down on the amount of time you waste looking in the wrong places. - Get your questions answered by the right mentor at the right time. - Above all, get the correct advice when you need it most and finally Learn. Having a mentor go through the journey with you is the difference between success and failure - most of the time. + Most of us will agree that we spent a significant amount of time trying to learn what we have learned so far. The other fact is that most of that time went to waste because we did not know where to look or who to ask questions when we needed it most. So, today we join hands in harmony to eliminate the time wastage and focus on building the best products on the planet and beyond.


-
-
-
-

Get Matched

-

- Once you register, we automatically match you with a mentor (if you are looking for one) and if no mentor is available, we add your account to the queue in the order your account was created. -

-
- -
-
-

Learn To Code

-

- Once you are matched with an experienced mentor, you will start learning with their guidance. Get your questions answered. Contact them when you need help and save yourself a lot of time learning. -

-
- -
-
-

Be a Mentor

-

- When you have learned what you need, you get an opportunity to be .. you guessed it, a mentor to someone else. This is simply a way of giving back to the community and continue learning new skills. -

-
+
+
+
+ + + + + + + + + + + + @foreach($users as $key => $value) + + + + + + + + @endforeach + +
FirstNameLocationBioView
{{ $value->first }}{{ $value->last }}{{ $value->location }}{{ $value->bio }} + View this Nerd +
+
+

+
- - - -
-
-