block the login in the controller as well

Signed-off-by: szaimen <szaimen@e.mail.de>
This commit is contained in:
szaimen 2022-01-14 11:39:39 +01:00
parent 0010a6cfa3
commit f6fc87354d

View file

@ -12,12 +12,17 @@ use Psr\Http\Message\ServerRequestInterface as Request;
class LoginController
{
private AuthManager $authManager;
private DockerActionManager $dockerActionManager;
public function __construct(AuthManager $authManager) {
public function __construct(AuthManager $authManager, DockerActionManager $dockerActionManager) {
$this->authManager = $authManager;
$this->dockerActionManager = $dockerActionManager;
}
public function TryLogin(Request $request, Response $response, $args) : Response {
if (!$this->dockerActionManager->isLoginAllowed()) {
return $response->withHeader('Location', '/')->withStatus(302);
}
$password = $request->getParsedBody()['password'];
if($this->authManager->CheckCredentials($password)) {
$this->authManager->SetAuthState(true);