Beispiel #1
0
 public static function RegisterUser($loginID, $password, $longName, $shortName, $emailAddress = null)
 {
     $CurrentTenant = Tenant::GetCurrent();
     // create an instance of the User object in this tenant
     $obj = $CurrentTenant->GetObject("User");
     // retrieve the salted password from the User object
     $pwsalt = $obj->GetMethod("SaltPassword")->Execute();
     // tell the User object to hash the password
     $pwhash = $obj->GetMethod("HashPassword")->Execute(array(new TenantObjectMethodParameterValue("input", $pwsalt . $password)));
     $inst = $obj->CreateInstance(array(new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("LoginID"), $loginID), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("DisplayName"), $longName), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("URL"), $shortName), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("EmailAddress"), $emailAddress), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("PasswordHash"), $pwhash), new TenantObjectInstancePropertyValue($obj->GetInstanceProperty("PasswordSalt"), $pwsalt)));
     if ($inst != null) {
         return UserRegistrationStatus::AwaitingVerification;
     }
     global $MySQL;
     RegistrationManager::$ErrorCode = $MySQL->errno;
     // DataFX::$Errors->Items[0]->Code;
     RegistrationManager::$ErrorMessage = $MySQL->error;
     // DataFX::$Errors->Items[0]->Message;
     return UserRegistrationStatus::GeneralError;
 }