Add redirects to the login page
This commit is contained in:
parent
5d998b0e33
commit
40b7b321ec
@ -36,17 +36,21 @@ class Login
|
||||
$app->post('/login', function ($request, $response, $args) {
|
||||
// Render index view
|
||||
$post = $request->getParsedBody();
|
||||
$query = $request->getQueryParams();
|
||||
$redirect = $query['redirect'];
|
||||
|
||||
try {
|
||||
$resp = $this->auth->login($post['rekeningnr'], $post['pascode']);
|
||||
|
||||
if ($resp) {
|
||||
return Redirect::create($request, $response, '/');
|
||||
if ($resp && $redirect !== "") {
|
||||
return Redirect::create($request, $response, $redirect);
|
||||
} elseif ($resp) {
|
||||
return Redirect::create($request, $response, '/rekeningen');
|
||||
} else {
|
||||
return Redirect::create($request, $response, '/login?error');
|
||||
return Redirect::create($request, $response, '/login?error&redirect='.$redirect);
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
return Redirect::create($request, $response, '/login?error');
|
||||
return Redirect::create($request, $response, '/login?error&redirect='.$redirect);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
?>
|
||||
<div class="alert alert-warning" role="alert">De ingevulde gegevens zijn incorrect. Probeer het opnieuw.</div><br/>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<form method="post" action="">
|
||||
<input type="text" name="rekeningnr" placeholder="Rekeningnummer (alleen cijfers)">
|
||||
|
Reference in New Issue
Block a user