浏览代码

auto redirect after succesfull login/logout

master
Ruben De Baets 2 年前
父节点
当前提交
d3f6b26af3
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2
    1
      public/index.php

+ 2
- 1
public/index.php 查看文件

@@ -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');
}

正在加载...
取消
保存