From 5b9f9aa34f0fbfa4de741047c51d7ba46482b7e9 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 3 Jan 2016 12:21:43 -0500 Subject: + Added controller for new MVC "Auth" --- app/controller/auth.control.php | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/controller/auth.control.php (limited to 'app/controller') diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php new file mode 100644 index 0000000..00c71f6 --- /dev/null +++ b/app/controller/auth.control.php @@ -0,0 +1,33 @@ +action_default($mod); + break; + } + } + + function action_default($mod) + { + $mod->deflt(); + include "view/auth/default.view.php"; + } +} + +?> -- cgit v1.2.3 From abb659a2753054158e9f7ec26271740a64a07e7d Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 3 Jan 2016 15:49:33 -0500 Subject: * Hooked the Auth MVC from the Root controller --- app/controller/root.control.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/controller') diff --git a/app/controller/root.control.php b/app/controller/root.control.php index 437cae1..b44ad76 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,12 @@ class Root extends Controller } /* TODO */ + /* TODO -- only auth if logged out */ else - echo "Configuration is present!"; + { + $ctrl = new Auth(); + $ctrl->handle($argv); + } } /* -- cgit v1.2.3 From 3a111ed74e89e9634e5baf4375625acc6ad262e6 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Thu, 28 Jan 2016 20:39:47 -0500 Subject: Finish signup and initialSignup actions on Auth MVC If no accounts exist no login page will be shown. Instead, the app presents the signup page to allow the administrator to create his account. This is the only case where a new account should be an admin by default. --- app/controller/auth.control.php | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'app/controller') diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php index 00c71f6..7fafd11 100644 --- a/app/controller/auth.control.php +++ b/app/controller/auth.control.php @@ -17,6 +17,10 @@ class Auth extends Controller switch ($_REQUEST['input']['action']) { + case "signup": + $this->action_signup($mod); + break; + default: $this->action_default($mod); break; @@ -25,8 +29,22 @@ class Auth extends Controller function action_default($mod) { - $mod->deflt(); - include "view/auth/default.view.php"; + if ($mod->deflt()) + include "view/auth/default.view.php"; + else + $this->action_initial_signup($mod); + } + + function action_initial_signup($mod) + { + $mod->initialSignup(); + $this->action_signup($mod); + } + + function action_signup($mod) + { + $mod->signup(); + include "view/auth/signup.view.php"; } } -- cgit v1.2.3 From ed1b89d4aa07393d7a9f75c689c4877acfa38826 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 30 Jan 2016 21:49:42 -0500 Subject: Implement signup_submit action on Auth MVC Submissions to the Auth signup page are now fully handled by either creating a new account (User object in the system) or posting an error message to the page (Auth model) --- app/controller/auth.control.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controller') diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php index 7fafd11..693d190 100644 --- a/app/controller/auth.control.php +++ b/app/controller/auth.control.php @@ -21,6 +21,10 @@ class Auth extends Controller $this->action_signup($mod); break; + case "signup_submit": + $this->action_signup_submit($mod); + break; + default: $this->action_default($mod); break; @@ -46,6 +50,12 @@ class Auth extends Controller $mod->signup(); include "view/auth/signup.view.php"; } + + function action_signup_submit($mod) + { + $mod->signupSubmit($_REQUEST['input']); + $this->action_signup($mod); + } } ?> -- cgit v1.2.3 From 1a2cf00b5e1a9c00be823eb655a76f8625bf32b5 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 31 Jan 2016 12:47:04 -0500 Subject: Merge Auth MVC, initial_signup action into signup There was a mistake that caused the page notice about no accounts existing to sometimes not showup in error. This merge resolves that issue as well as tidys up the code a bit. --- app/controller/auth.control.php | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'app/controller') diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php index 693d190..9bb8349 100644 --- a/app/controller/auth.control.php +++ b/app/controller/auth.control.php @@ -36,13 +36,7 @@ class Auth extends Controller if ($mod->deflt()) include "view/auth/default.view.php"; else - $this->action_initial_signup($mod); - } - - function action_initial_signup($mod) - { - $mod->initialSignup(); - $this->action_signup($mod); + $this->action_signup($mod); } function action_signup($mod) -- cgit v1.2.3 From 8640c13c934ff3e6d907b1e335edb83da088a2ca Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 31 Jan 2016 20:33:38 -0500 Subject: Log in on signup success Now, on a successful submission of the signup view form (Auth MVC), the app automatically logs in the newly-created user and redirects to Framework::ap() . "/". Placeholder code has been added to the root controller to simply var_dump() the current logged in user if one exists, otherwise the login view (Auth MVC) is shown --- app/controller/root.control.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'app/controller') diff --git a/app/controller/root.control.php b/app/controller/root.control.php index b44ad76..06abf27 100644 --- a/app/controller/root.control.php +++ b/app/controller/root.control.php @@ -29,11 +29,19 @@ class Root extends Controller /* TODO */ /* TODO -- only auth if logged out */ - else + else if (!$this->getCurrentUser()) { $ctrl = new Auth(); $ctrl->handle($argv); } + + else + { + echo "logged in as:!"; + echo "
";
+            var_dump($this->getCurrentUser());
+            echo "
"; + } } /* -- cgit v1.2.3 From faa6ca0b2e9430d2f9d689aab583a7f881ed03bf Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Mon, 1 Feb 2016 19:33:57 -0500 Subject: Implement 'login' action on Auth MVC Finished initial functionality for Auth MVC by implementing the login feature --- app/controller/auth.control.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'app/controller') diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php index 9bb8349..0e970dd 100644 --- a/app/controller/auth.control.php +++ b/app/controller/auth.control.php @@ -25,6 +25,10 @@ class Auth extends Controller $this->action_signup_submit($mod); break; + case "login": + $this->action_login($mod); + break; + default: $this->action_default($mod); break; @@ -50,6 +54,12 @@ class Auth extends Controller $mod->signupSubmit($_REQUEST['input']); $this->action_signup($mod); } + + function action_login($mod) + { + $mod->login($_REQUEST['input']); + $this->action_default($mod); + } } ?> -- cgit v1.2.3 From 0b6f4ab1814c097ac30e293e91ecbf446fecaf48 Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sat, 6 Feb 2016 19:01:43 -0500 Subject: Update Auth controller to work with recent MVC redesign (HEAD^^) --- app/controller/auth.control.php | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'app/controller') diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php index 0e970dd..6269c9c 100644 --- a/app/controller/auth.control.php +++ b/app/controller/auth.control.php @@ -21,10 +21,6 @@ class Auth extends Controller $this->action_signup($mod); break; - case "signup_submit": - $this->action_signup_submit($mod); - break; - case "login": $this->action_login($mod); break; @@ -37,22 +33,14 @@ class Auth extends Controller function action_default($mod) { - if ($mod->deflt()) - include "view/auth/default.view.php"; - else - $this->action_signup($mod); + $mod->deflt(); + include "view/auth/default.view.php"; } function action_signup($mod) { - $mod->signup(); - include "view/auth/signup.view.php"; - } - - function action_signup_submit($mod) - { - $mod->signupSubmit($_REQUEST['input']); - $this->action_signup($mod); + $mod->signup($_REQUEST['input']); + $this->action_default($mod); } function action_login($mod) -- cgit v1.2.3 From c5564a0a2ae183c533a38905eccdbf383030cd4c Mon Sep 17 00:00:00 2001 From: Malf Furious Date: Sun, 7 Feb 2016 13:45:46 -0500 Subject: Modify Auth controller description This MVC will not be used to handle deauth (logout) anymore. To improve app flow, a separate one will be created for this purpose --- app/controller/auth.control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/controller') diff --git a/app/controller/auth.control.php b/app/controller/auth.control.php index 6269c9c..f441310 100644 --- a/app/controller/auth.control.php +++ b/app/controller/auth.control.php @@ -4,7 +4,7 @@ require_once "class/controller.class.php"; require_once "model/auth.mod.php"; /* - * Auth is used to login, logout, or register new user accounts + * Auth is used to login or register new user accounts */ class Auth extends Controller { -- cgit v1.2.3