Browse Source

auto redirect after succesfull login/logout

master
Ruben De Baets 2 years ago
parent
commit
d3f6b26af3
1 changed files with 2 additions and 1 deletions
  1. 2
    1
      public/index.php

+ 2
- 1
public/index.php View File

@@ -62,7 +62,7 @@ $app->get('/logout', function (Request $request, Response $response, array $args
addNavbar($response);
$response->getBody()->write('Logged out');
addFooter($response);
return $response;
return $response->withHeader('Location', '/')->withStatus(302);
});

$app->map(['GET', 'POST'], '/login', function (Request $request, Response $response, array $args) {
@@ -83,6 +83,7 @@ $app->map(['GET', 'POST'], '/login', function (Request $request, Response $respo
addNavbar($response);
$response->getBody()->write('Logged in');
addFooter($response);
return $response->withHeader('Location', '/')->withStatus(302);
} else {
$response->getBody()->write('Username and/or password incorrect');
}

Loading…
Cancel
Save