From f07413a1829898afd79227a26ef9e8abeaa680c7 Mon Sep 17 00:00:00 2001 From: szaimen Date: Tue, 7 Dec 2021 18:01:20 +0100 Subject: [PATCH] remove the username for the aio interface Signed-off-by: szaimen --- php/src/Auth/AuthManager.php | 8 ++------ php/src/Controller/LoginController.php | 3 +-- php/src/Data/ConfigurationManager.php | 5 ----- php/templates/login.twig | 3 +-- php/templates/setup.twig | 5 ++--- 5 files changed, 6 insertions(+), 18 deletions(-) diff --git a/php/src/Auth/AuthManager.php b/php/src/Auth/AuthManager.php index dc3e2fb6..f18f1a7b 100644 --- a/php/src/Auth/AuthManager.php +++ b/php/src/Auth/AuthManager.php @@ -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 { diff --git a/php/src/Controller/LoginController.php b/php/src/Controller/LoginController.php index 1f262d71..c917115c 100644 --- a/php/src/Controller/LoginController.php +++ b/php/src/Controller/LoginController.php @@ -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); } diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index 17bb504a..68b34bb4 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -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); } diff --git a/php/templates/login.twig b/php/templates/login.twig index 16737429..06b875ea 100644 --- a/php/templates/login.twig +++ b/php/templates/login.twig @@ -5,9 +5,8 @@