public function onBeforeWrite()
    {
        if (!$this->owner->MFAEnabled && SiteConfig::current_site_config()->ForceMFA) {
            $this->owner->MFAEnabled = true;
            $this->owner->updateMFA = true;
        }
        if (!$this->owner->BackupCodeSalt || $this->owner->updateMFA) {
            $algorithm = Security::config()->get('password_encryption_algorithm');

            $encryptor = PasswordEncryptor::create_for_algorithm($algorithm);

            // No password. It's not even used in the salt generation
            $this->owner->BackupCodeSalt = $encryptor->salt('');
        }
    }