diff options
Diffstat (limited to 'app/controller')
-rw-r--r-- | app/controller/auth.control.php | 53 | ||||
-rw-r--r-- | app/controller/root.control.php | 15 |
2 files changed, 67 insertions, 1 deletions
diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php new file mode 100644 index 0000000..f441310 --- /dev/null +++ b/app/controller/auth.control.php @@ -0,0 +1,53 @@ +<?php + +require_once "class/controller.class.php"; +require_once "model/auth.mod.php"; + +/* + * Auth is used to login or register new user accounts + */ +class Auth extends Controller +{ + /* + * Controller implementation + */ + function handle($argv) + { + $mod = new AuthModel(); + + switch ($_REQUEST['input']['action']) + { + case "signup": + $this->action_signup($mod); + break; + + case "login": + $this->action_login($mod); + break; + + default: + $this->action_default($mod); + break; + } + } + + function action_default($mod) + { + $mod->deflt(); + include "view/auth/default.view.php"; + } + + function action_signup($mod) + { + $mod->signup($_REQUEST['input']); + $this->action_default($mod); + } + + function action_login($mod) + { + $mod->login($_REQUEST['input']); + $this->action_default($mod); + } +} + +?> diff --git a/app/controller/root.control.php b/app/controller/root.control.php index 437cae1..06abf27 100644 --- a/app/controller/root.control.php +++ b/app/controller/root.control.php @@ -2,6 +2,7 @@ require_once "class/controller.class.php"; require_once "controller/sysconf.control.php"; +require_once "controller/auth.control.php"; /* * Root-level controller for Scrott app. This object will delegate the page request to the @@ -27,8 +28,20 @@ class Root extends Controller } /* TODO */ + /* TODO -- only auth if logged out */ + else if (!$this->getCurrentUser()) + { + $ctrl = new Auth(); + $ctrl->handle($argv); + } + else - echo "Configuration is present!"; + { + echo "logged in as:!"; + echo "<pre>"; + var_dump($this->getCurrentUser()); + echo "</pre>"; + } } /* |