summaryrefslogtreecommitdiff
path: root/login.php
diff options
context:
space:
mode:
authorKyle McFarland <tfkyle@gmail.com>2018-01-31 00:51:07 -0600
committerKyle McFarland <tfkyle@gmail.com>2018-01-31 00:51:07 -0600
commit61d1aa04d8d44b17bfe6dace90088669fc6c3df8 (patch)
tree7ede15c880e4c41a18cded46fe6d03fb2dc4543b /login.php
downloadmcoop-master.zip
mcoop-master.tar.gz
mcoop-master.tar.bz2
Initial importHEADmaster
* 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.php32
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
+));
+
+?>