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 @@