Example #1
0
 /**
  * This method show the user's dashboard
  * @return \Illuminate\View\View
  */
 public function getIndex()
 {
     //We get the user information and remove the password and token from the response
     $user_profile = User::findBy(['_id' => Auth::user()->_id], ['password' => false, 'token' => false, 'token' => false]);
     if (!$user_profile) {
         Abort(404);
     }
     return view('user.dashboard', ['user_profile' => $user_profile]);
 }
Example #2
0
 /**
  * This method show the user's profile
  * @return \Illuminate\View\View
  */
 public function getIndex($username)
 {
     //We get the user information and remove the password and token from the response
     $user_profile = User::findBy(['username' => $username], ['password' => false, 'token' => false, 'token' => false]);
     if (!$user_profile) {
         Abort(404);
     }
     //var_dump($user_profile);
     return view('user.profile', ['user_profile' => $user_profile]);
 }
Example #3
0
 /**
  * @param ResetPasswordRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postResetPassword(ResetPasswordRequest $request)
 {
     $code = $request->input('code');
     $validator = Validator::make(['code' => $code], ['code' => 'alpha_num']);
     if ($validator->fails()) {
         abort(404);
     }
     //Find the user using the reset_token code and
     //only if the expiration date is lower than the new date
     $user = User::findBy(['resetPassword.reset_token' => $code, 'resetPassword.expiresAt' => ['$gt' => new \MongoDate(time())]]);
     if (!$user) {
         abort(404);
     }
     // Save new password & remove reset password token
     $user->password = Hash::make($request->input('password'));
     $user->resetPassword = null;
     $user->save();
     Session::flash('notify', ['type' => 'success', 'text' => 'Tu password se ha cambiado exitosamente']);
     return redirect()->route('login');
 }