Skip to content
Snippets Groups Projects
Commit a09df6d4 authored by Joas Schilling's avatar Joas Schilling
Browse files

Verify that the encryption module exists before setting it

parent e58029f8
Branches
No related tags found
No related merge requests found
......@@ -101,17 +101,17 @@ class Manager implements IManager {
throw new Exceptions\ModuleAlreadyExistsException($id, $displayName);
}
$defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
if (empty($defaultEncryptionModuleId)) {
$this->setDefaultEncryptionModule($id);
}
$this->encryptionModules[$id] = [
'id' => $id,
'displayName' => $displayName,
'callback' => $callback,
];
$defaultEncryptionModuleId = $this->getDefaultEncryptionModuleId();
if (empty($defaultEncryptionModuleId)) {
$this->setDefaultEncryptionModule($id);
}
}
/**
......@@ -182,6 +182,7 @@ class Manager implements IManager {
*/
public function setDefaultEncryptionModule($moduleId) {
try {
$this->getEncryptionModule($moduleId);
$this->config->setAppValue('core', 'default_encryption_module', $moduleId);
return true;
} catch (\Exception $e) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment