protected function _getSecureUsers()
{
$credentials = Text::explodeNewLines(trim($this->fluidbookSettings->secureClientSidePasswordCredentials));
- if ($this->fluidbookSettings->secureClientSideMode == '1') {
+ $mode = $this->fluidbookSettings->secureClientSideMode ?? '0';
+
+ if ($mode == '1') {
$credentials[] = 'fluidbook';
} else {
$credentials[] = 'fluidbook:LatacaM4##*';
foreach ($credentials as $credential) {
$salt = bin2hex(random_bytes(5));
$e = explode(':', $credential);
- if ($this->fluidbookSettings->secureClientSideMode == '0' && count($e) <= 1) {
+ if ($mode == '0' && count($e) <= 1) {
continue;
}
$usersalt = bin2hex(random_bytes(5));
$user = hash("sha256", $usersalt . '+' . mb_strtolower($e[0]));
$u = ['salt' => $salt, 'usersalt' => $usersalt];
- if (count($e) > 1 && $this->fluidbookSettings->secureClientSideMode != '0') {
+ if (count($e) > 1 && $mode == '0') {
$u['hash'] = hash("sha256", $salt . '-' . Text::removeAccents($e[1]));
}
$users[$user] = $u;
return $res;
}
+ public function onRetrieved(): bool
+ {
+ $this->setDefaults();
+ return parent::onRetrieved();
+ }
+
public function getAnchorsFromExcel()
{
$res = [];
$version = 3;
}
$this->version = $version;
- $fields = ['imageFormat', 'secureClientSidePassword', 'relay_url_params'];
+ $this->setDefaults();
+ $this->save();
+
+ DB::update('UPDATE ' . WorkshopMigration::OLD_DB . '.books SET version=' . $version . ' WHERE book_id=' . $this->id);
+ }
+
+ public function setDefaults()
+ {
+ $fields = ['imageFormat', 'secureClientSidePassword', 'secureClientSideMode', 'relay_url_params'];
foreach ($fields as $n) {
$f = $this->getField($n);
if (null === $this->{$n}) {
}
}
$this->svgToCanvas = !$this->svgToCanvas ? 0 : 1;
- $this->save();
-
- DB::update('UPDATE ' . WorkshopMigration::OLD_DB . '.books SET version=' . $version . ' WHERE book_id=' . $this->id);
}
public function generateThumbnailsPreview($sync = false)