Exemple #1
0
 public function other($argument = false)
 {
     $model = new Help_Model();
     echo "we are inside other";
     $t = new UserManagement();
     $t->createUser();
 }
Exemple #2
0
 public function signupAction()
 {
     $errorCount = array();
     $response = array();
     $fname = isset($_POST["fname"]) ? $_POST["fname"] : null;
     $lname = isset($_POST["lname"]) ? $_POST["lname"] : null;
     $email = isset($_POST["email"]) ? $_POST["email"] : null;
     $password = isset($_POST["password1"]) ? $_POST["password1"] : null;
     if ($fname == null || $lname == null || $email == null || $password == null) {
         return false;
     }
     $result = UserManagement::createUser($email, $password, $fname, $lname);
     if ($result > 0) {
         $response["success"] = true;
     } else {
         $response["success"] = false;
     }
     echo json_encode($response);
 }
 /**
  * Function to test the function logOutFromALLDevices
  */
 public function testLogOutFromAllDevices()
 {
     UserManagement::createUser("owasp1", "owasp", "*****@*****.**");
     //create a user.
     User::activateAccount("owasp1");
     $obj1 = UserManagement::logIn("owasp1", "owasp");
     $obj2 = UserManagement::logIn("owasp1", "owasp");
     //log in the same user from different device.
     $obj3 = UserManagement::logIn("owasp1", "owasp");
     //log in the same user from different device.
     //set session variables to imitate real cookies.
     $randomValue = randstr(32);
     SQL("INSERT INTO `SESSION` (`SESSION_ID`, `DATE_CREATED`, `LAST_ACTIVITY`, `USERID`) VALUES (?, ?, ?, ?)", array($randomValue, time(), time(), $obj3->getUserID()));
     SQL("INSERT INTO `SESSION` (`SESSION_ID`, `DATE_CREATED`, `LAST_ACTIVITY`, `USERID`) VALUES (?, ?, ?, ?)", array(randstr(32), time(), time(), $obj3->getUserID()));
     SQL("INSERT INTO `SESSION` (`SESSION_ID`, `DATE_CREATED`, `LAST_ACTIVITY`, `USERID`) VALUES (?, ?, ?, ?)", array(randstr(32), time(), time(), $obj3->getUserID()));
     $_COOKIE['sessionid'] = $randomValue;
     UserManagement::logOutFromAllDevices($obj1->getUserID());
     //This will delete all the sessions from the DB
     $result = SQL("SELECT * FROM SESSION");
     $Test = count($result) == 0;
     UserManagement::deleteUser("owasp1");
     //delete the newly created users.
     $this->assertTrue($Test);
 }