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) {
|
$app->post('/login', function ($request, $response, $args) {
|
||||||
// Render index view
|
// Render index view
|
||||||
$post = $request->getParsedBody();
|
$post = $request->getParsedBody();
|
||||||
|
$query = $request->getQueryParams();
|
||||||
|
$redirect = $query['redirect'];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$resp = $this->auth->login($post['rekeningnr'], $post['pascode']);
|
$resp = $this->auth->login($post['rekeningnr'], $post['pascode']);
|
||||||
|
|
||||||
if ($resp) {
|
if ($resp && $redirect !== "") {
|
||||||
return Redirect::create($request, $response, '/');
|
return Redirect::create($request, $response, $redirect);
|
||||||
|
} elseif ($resp) {
|
||||||
|
return Redirect::create($request, $response, '/rekeningen');
|
||||||
} else {
|
} else {
|
||||||
return Redirect::create($request, $response, '/login?error');
|
return Redirect::create($request, $response, '/login?error&redirect='.$redirect);
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} 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/>
|
<div class="alert alert-warning" role="alert">De ingevulde gegevens zijn incorrect. Probeer het opnieuw.</div><br/>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
} ?>
|
} ?>
|
||||||
<form method="post" action="">
|
<form method="post" action="">
|
||||||
<input type="text" name="rekeningnr" placeholder="Rekeningnummer (alleen cijfers)">
|
<input type="text" name="rekeningnr" placeholder="Rekeningnummer (alleen cijfers)">
|
||||||
|
Reference in New Issue
Block a user