public function createUser($authUser, $authEmail, $authPass, $authQuestion, $authAnswer, $extraKey) { $emailExists = AuthUserData::emailExist($authEmail); $userExists = AuthUserData::userExist($authUser); if ($userExists && $emailExists && $extraKey != '') { $this->loadUser($authUser); if (!$this->checkKey($extraKey, 'SignUp')) { AuthUserData::clearExtraKey($this->userData['userID']); return false; } if ($this->userData['password'] != $authPass || $this->userData['securityQuestion'] != $authQuestion || $this->userData['securityAnswer'] != $authAnswer) { AuthUserData::clearExtraKey($this->userData['userID']); return false; } $this->createAndUpdatePassword($authPass); AuthUserData::clearExtraKey($this->userData['userID']); AuthUserData::confirmEmail($this->userData['userID']); return true; } else { if (!$userExists && !$emailExists && $extraKey == '') { $newExtraKey = $this->createPin(_PIN_SIGN_UP_PLUS_CHARS_); $salt = bin2hex(mcrypt_create_iv(_PASSWORD_SALT_IV_SIZE_, MCRYPT_DEV_URANDOM)); $userID = AuthUserData::addNewUser($authUser, $authEmail, $authPass, $salt, $authQuestion, $authAnswer); $this->loadUserForced($authUser); AuthUserRolesData::addUserRole($userID, 'i18nAdmin'); AuthUserData::updateExtraKey($userID, $newExtraKey, 'SignUp'); header('Auth-Second-Factor: true'); $this->sendEmailNotification('SignUp', array(array('{{PIN}}'), array(strtoupper($newExtraKey)))); return true; } } return false; }
public function createSubUser($userName, $email, $newPassword, $twoFactorType, $roles) { if (!$this->validated) { $this->userID = AuthUserData::addSubNewUser($userName, $email, $this->parentUserID); AuthUserData::confirmEmail(AuthUserData::getUserIDByUserName($userName)); $this->validated = true; $this->updateSubUserPassword($newPassword); $this->updateSubUser($twoFactorType, $roles); return $this->userID; } return false; }