Example #1
0
 /**
  * To create a new user.
  * @param string $userID        The desired ID of the user
  * @param string $password      The password of the user
  * @param string $email         The primary email of the user
  * @return boolean              Returns if the user is created. False otherwise
  * @throws UserExistsException  Will be thrown if the user already exists in the DB
  * @throws UserIDInvalid        Will be thrown if the user ID Invalid ( It could be null, empty, it's length outside limit, use forbidden chars)
  */
 public static function createUser($userID, $password, $email)
 {
     if (!UserManagement::userExists($userID)) {
         User::newUserObject($userID, $password, $email);
         return TRUE;
     }
     return FALSE;
 }
Example #2
0
 /**
  * Function to be run before every test*() functions.
  */
 public function setUp()
 {
     BasicPasswordManagement::$hashAlgo = "haval256,5";
     //choose salting algo.
     User::newUserObject("rash", 'testing', "*****@*****.**");
     //create a user.
     User::activateAccount("rash");
     //activate the user account
     $this->user = User::existingUserObject("rash", "testing");
     //get the user object
     $this->obj = new AdvancedPasswordManagement($this->user->getUserID(), 'testing');
     //create object to AdvancedPasswordManagement class.
 }
Example #3
0
 /**
  * Function to be run before every test*() functions.
  */
 public function setUp()
 {
     BasicPasswordManagement::$hashAlgo = "haval256,5";
     //choose a hashing algo.
     User::newUserObject("rash", 'testing', "*****@*****.**");
     //create a new user.
     User::activateAccount("rash");
     //activate the user account
     $this->obj = User::existingUserObject("rash", "testing");
     //get the user object
     $this->xobj = new XUser($this->obj);
     //get the XUser object
 }
Example #4
0
 /**
  * Function to be run before every test*() functions.
  */
 public function setUp()
 {
     time("RESET");
     //Create users.
     User::newUserObject("abcd", "resting", "*****@*****.**");
     User::activateAccount("abcd");
     $this->user[0] = User::existingUserObject("abcd", "resting");
     //Create users.
     User::newUserObject("efgh", "resting", "*****@*****.**");
     User::activateAccount("efgh");
     $this->user[1] = User::existingUserObject("efgh", "resting");
     //create new sessions associated with each user.
     $this->session[0] = new Session();
     $this->session[1] = new Session();
     $this->session[2] = new Session();
     $this->session[0]->newSession($this->user[0]->getUserID());
     //session for user 0.
     $this->session[1]->newSession($this->user[0]->getUserID());
     //session for user 0.
     $this->session[2]->newSession($this->user[1]->getUserID());
     //session for user 1.
 }
Example #5
0
 /**
  * Function to test if allows to create a user with an Null ID
  * @expectedException phpsec\UserIDInvalid
  */
 public function testUserIDNull()
 {
     BasicPasswordManagement::$hashAlgo = "haval256,5";
     //choose a hashing algo
     User::newUserObject(null, 'testing', "*****@*****.**");
     //create a new user
 }