mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-04 04:56:52 +00:00
Make AIO_TOKEN an attribute
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
85654218dd
commit
681ec13b8d
4 changed files with 8 additions and 10 deletions
|
|
@ -19,7 +19,7 @@ readonly class AuthManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function CheckToken(string $token) : bool {
|
public function CheckToken(string $token) : bool {
|
||||||
return hash_equals($this->configurationManager->GetToken(), $token);
|
return hash_equals($this->configurationManager->AIO_TOKEN, $token);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function SetAuthState(bool $isLoggedIn) : void {
|
public function SetAuthState(bool $isLoggedIn) : void {
|
||||||
|
|
|
||||||
|
|
@ -213,10 +213,7 @@ readonly class DockerController {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function startTopContainer(bool $pullImage) : void {
|
public function startTopContainer(bool $pullImage) : void {
|
||||||
$config = $this->configurationManager->GetConfig();
|
$this->configurationManager->AIO_TOKEN = bin2hex(random_bytes(24));
|
||||||
// set AIO_TOKEN
|
|
||||||
$config['AIO_TOKEN'] = bin2hex(random_bytes(24));
|
|
||||||
$this->configurationManager->WriteConfig($config);
|
|
||||||
|
|
||||||
// Stop domaincheck since apache would not be able to start otherwise
|
// Stop domaincheck since apache would not be able to start otherwise
|
||||||
$this->StopDomaincheckContainer();
|
$this->StopDomaincheckContainer();
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,11 @@ class ConfigurationManager
|
||||||
|
|
||||||
private bool $noWrite = false;
|
private bool $noWrite = false;
|
||||||
|
|
||||||
|
public string $AIO_TOKEN {
|
||||||
|
get => $this->get('AIO_TOKEN', '');
|
||||||
|
set { $this->set('AIO_TOKEN', $value); }
|
||||||
|
}
|
||||||
|
|
||||||
public function GetConfig() : array
|
public function GetConfig() : array
|
||||||
{
|
{
|
||||||
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
||||||
|
|
@ -28,10 +33,6 @@ class ConfigurationManager
|
||||||
return $this->GetConfig()['password'];
|
return $this->GetConfig()['password'];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetToken() : string {
|
|
||||||
return $this->GetConfig()['AIO_TOKEN'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function SetPassword(string $password) : void {
|
public function SetPassword(string $password) : void {
|
||||||
$config = $this->GetConfig();
|
$config = $this->GetConfig();
|
||||||
$config['password'] = $password;
|
$config['password'] = $password;
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,7 @@ readonly class DockerActionManager {
|
||||||
return match ($placeholder) {
|
return match ($placeholder) {
|
||||||
'NC_DOMAIN' => $this->configurationManager->GetDomain(),
|
'NC_DOMAIN' => $this->configurationManager->GetDomain(),
|
||||||
'NC_BASE_DN' => $this->configurationManager->GetBaseDN(),
|
'NC_BASE_DN' => $this->configurationManager->GetBaseDN(),
|
||||||
'AIO_TOKEN' => $this->configurationManager->GetToken(),
|
'AIO_TOKEN' => $this->configurationManager->AIO_TOKEN,
|
||||||
'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->GetBorgRemoteRepo(),
|
'BORGBACKUP_REMOTE_REPO' => $this->configurationManager->GetBorgRemoteRepo(),
|
||||||
'BORGBACKUP_MODE' => $this->configurationManager->GetBackupMode(),
|
'BORGBACKUP_MODE' => $this->configurationManager->GetBackupMode(),
|
||||||
'AIO_URL' => $this->configurationManager->GetAIOURL(),
|
'AIO_URL' => $this->configurationManager->GetAIOURL(),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue