remove the username for the aio interface

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2021-12-07 18:01:20 +01:00
parent 3a67636092
commit f07413a182
5 changed files with 6 additions and 18 deletions

View file

@ -12,12 +12,8 @@ class AuthManager {
$this->configurationManager = $configurationManager;
}
public function CheckCredentials(string $username, string $password) : bool {
if($username === $this->configurationManager->GetUserName()) {
return hash_equals($this->configurationManager->GetPassword(), $password);
}
return false;
public function CheckCredentials(string $password) : bool {
return hash_equals($this->configurationManager->GetPassword(), $password);
}
public function CheckToken(string $token) : bool {

View file

@ -18,9 +18,8 @@ class LoginController
}
public function TryLogin(Request $request, Response $response, $args) : Response {
$userName = $request->getParsedBody()['username'];
$password = $request->getParsedBody()['password'];
if($this->authManager->CheckCredentials($userName, $password)) {
if($this->authManager->CheckCredentials($password)) {
$this->authManager->SetAuthState(true);
return $response->withHeader('Location', '/')->withStatus(302);
}

View file

@ -18,10 +18,6 @@ class ConfigurationManager
return [];
}
public function GetUserName() : string {
return $this->GetConfig()['username'];
}
public function GetPassword() : string {
return $this->GetConfig()['password'];
}
@ -32,7 +28,6 @@ class ConfigurationManager
public function SetPassword(string $password) : void {
$config = $this->GetConfig();
$config['username'] = 'admin';
$config['password'] = $password;
$this->WriteConfig($config);
}