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);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -26,8 +26,9 @@
|
||||
<?php if ($error) {
|
||||
?>
|
||||
<div class="alert alert-warning" role="alert">De ingevulde gegevens zijn incorrect. Probeer het opnieuw.</div><br/>
|
||||
<?php
|
||||
} ?>
|
||||
<?php
|
||||
|
||||
} ?>
|
||||
<form method="post" action="">
|
||||
<input type="text" name="rekeningnr" placeholder="Rekeningnummer (alleen cijfers)">
|
||||
<input type="password" name="pascode" placeholder="Pascode">
|
||||
|
Reference in New Issue
Block a user