diff options
author | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
---|---|---|
committer | Kyle McFarland <tfkyle@gmail.com> | 2018-01-31 00:51:07 -0600 |
commit | 61d1aa04d8d44b17bfe6dace90088669fc6c3df8 (patch) | |
tree | 7ede15c880e4c41a18cded46fe6d03fb2dc4543b /login.php | |
download | mcoop-master.zip mcoop-master.tar.gz mcoop-master.tar.bz2 |
* Registration system's almost done
* Just part way through implementing tasks
So not much done yet, but it's a start.
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 +)); + +?> |