fix the login form

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-03-31 16:41:48 +02:00
parent c1595afe2d
commit 9954641e02
3 changed files with 12 additions and 13 deletions

View file

@ -21,15 +21,17 @@ class LoginController
public function TryLogin(Request $request, Response $response, array $args) : Response {
if (!$this->dockerActionManager->isLoginAllowed()) {
return $response->withHeader('Location', '/')->withStatus(302);
$response->getBody()->write("The login is blocked since Nextcloud is running.");
return $response->withHeader('Location', '/')->withStatus(422);
}
$password = $request->getParsedBody()['password'] ?? '';
if($this->authManager->CheckCredentials($password)) {
$this->authManager->SetAuthState(true);
return $response->withHeader('Location', '/')->withStatus(302);
return $response->withHeader('Location', '/')->withStatus(201);
}
return $response->withHeader('Location', '/')->withStatus(302);
$response->getBody()->write("The password is false.");
return $response->withHeader('Location', '/')->withStatus(422);
}
public function GetTryLogin(Request $request, Response $response, array $args) : Response {