/**
  * Get the image of the user
  *
  * @param  Request $request the username and password of the user
  * @return Response             the image download
  */
 public function getSession(Request $request)
 {
     //get the email and password from the input
     $email = "";
     $password = "";
     if ($request->get('email') && $request->get('password')) {
         $password = $request->get('password');
         if (Libraries\InputValidator::isEmailValid($request->get('email'))) {
             $email = $request->get('email');
         } else {
             \App::abort(400, 'The contract of the api was not met');
         }
     } else {
         \App::abort(400, 'The contract of the api was not met');
     }
     //get the user based on the email
     $userRepo = new UserRepository(new User());
     $user = $userRepo->getUserBasedOnEmail($email);
     //fill the information of the user
     //if the user didn't exist
     $userInfo = [];
     if (!isset($user->password)) {
         \App::abort(404, 'The user doesn\'t exist in the database');
     } else {
         if ($user->password != sha1($password)) {
             \App::abort(404, 'The user doesn\'t exist in the database');
         }
         $imageUrl = \Request::getRequestUri() . $user->uuid . "/image";
         $userInfo = ["first_name" => $user->first_name, "last_name" => $user->last_name, "birth_date" => $user->date_of_birth, "gender" => $user->gender, "country_iso" => $user->country->iso_code, "profile_image" => $imageUrl, "user_id" => $user->uuid, "role" => $userRepo->getUserRole()->role, "email" => $user->email];
     }
     //send the results back to the user
     return json_encode($userInfo);
 }
 /**
  * Get the image of the user
  *
  * @param  Request $request the username and password of the user
  * @return Response             the image download
  */
 public function getSession(Request $request)
 {
     //get the email and password from the input
     $email = "";
     $password = "";
     if ($request->get('email') && $request->get('password')) {
         $password = $request->get('password');
         if (Libraries\InputValidator::isEmailValid($request->get('email'))) {
             $email = $request->get('email');
         } else {
             \App::abort(400, 'The contract of the api was not met');
         }
     } else {
         \App::abort(400, 'The contract of the api was not met');
     }
     //get the user based on the email
     $userRepo = new UserRepository(new User());
     $user = $userRepo->getUserBasedOnEmail($email);
     //fill the information of the user
     //if the user didn't exist
     $userInfo = [];
     if (!isset($user->password)) {
         \App::abort(404, 'The user doesn\'t exist in the database');
     } else {
         if ($user->password != sha1($password)) {
             \App::abort(404, 'The user doesn\'t exist in the database');
         }
         //send the results back to the user
         return json_encode(["points" => $userRepo->getUserPoints(), "status" => ["level" => $userRepo->getUserLevel()->id, "user_id" => $user->uuid]]);
     }
     //send the results back to the user
     return json_encode($userInfo);
 }
 public function testEmailValidationMethod()
 {
     $this->assertTrue(\App\Http\Libraries\InputValidator::IsEmailValid('*****@*****.**'));
     $this->assertFalse(\App\Http\Libraries\InputValidator::IsEmailValid('sadjad'));
 }