diff options
Diffstat (limited to 'login.php')
-rw-r--r-- | login.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/login.php b/login.php new file mode 100644 index 0000000..d310163 --- /dev/null +++ b/login.php @@ -0,0 +1,32 @@ +<?php +namespace mcoop; + +//$logout = true; + +require_once("recaptcha/autoload.php"); +require_once("vendor/autoload.php"); +require_once("common/config.php"); + +$danger_alerts = array(); +$success_alerts = array(); + +$login_attempted = false; +if (isset($_POST["username"], $_POST["passwd"])) { + $login_attempted = true; + try { + $db->login($_POST["username"], $_POST["passwd"], $sess_info); + $success_alerts[] = 'Successfully logged in, <a href="/">Continue</a>'; + } catch (UnknownMember $e) { + $danger_alerts[] = "Failed to login, no such user"; + } catch (LoginError $e) { + $danger_alerts[] = "Failed to login, {$e->getMessage()}"; + } +} + +echo $twig->render("login.tmpl", array( + "danger_alerts" => $danger_alerts, + "success_alerts" => $success_alerts, + "sess_info" => $sess_info +)); + +?> |