Last active
September 9, 2015 02:52
-
-
Save drmmr763/584ecf12d7179dee927f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
try { | |
$app->post('/login', function () use ($app, $userModel) { | |
if ( ! $userModel->login($_POST['username'], $_POST['password'])===true){ | |
throw new \Exception('Login failed, please check username/password and try again'); | |
} | |
$app->redirect('/'); | |
}); | |
} catch (\Exception $e) { | |
// halts the app here | |
$app->render('login.twig', array($e->getMessage())); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment