mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-04 04:56:52 +00:00
32 lines
833 B
PHP
32 lines
833 B
PHP
<?php
|
|
|
|
namespace AIO\Data;
|
|
|
|
use AIO\Auth\PasswordGenerator;
|
|
|
|
class Setup
|
|
{
|
|
private PasswordGenerator $passwordGenerator;
|
|
private ConfigurationManager $configurationManager;
|
|
|
|
public function __construct(
|
|
PasswordGenerator $passwordGenerator,
|
|
ConfigurationManager $configurationManager) {
|
|
$this->passwordGenerator = $passwordGenerator;
|
|
$this->configurationManager = $configurationManager;
|
|
}
|
|
|
|
public function Setup() : string {
|
|
if(!$this->CanBeInstalled()) {
|
|
return '';
|
|
}
|
|
|
|
$password = $this->passwordGenerator->GeneratePassword(8);
|
|
$this->configurationManager->SetPassword($password);
|
|
return $password;
|
|
}
|
|
|
|
public function CanBeInstalled() : bool {
|
|
return is_null($this->configurationManager->GetPassword());
|
|
}
|
|
}
|