From 3a111ed74e89e9634e5baf4375625acc6ad262e6 Mon Sep 17 00:00:00 2001
From: Malf Furious <m@lfurio.us>
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 ++++++++++++++++++++--
 app/model/auth.mod.php          | 15 +++++++++++++++
 2 files changed, 35 insertions(+), 2 deletions(-)

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";
     }
 }
 
diff --git a/app/model/auth.mod.php b/app/model/auth.mod.php
index 9cd6b7c..5b655d6 100644
--- a/app/model/auth.mod.php
+++ b/app/model/auth.mod.php
@@ -20,6 +20,21 @@ class AuthModel extends CommonModel
 
         return true;
     }
+
+    /*
+     * Initial signup action
+     */
+    function initialSignup()
+    {
+        $this->noaccounts = true;
+    }
+
+    /*
+     * Signup action
+     */
+    function signup()
+    {
+    }
 }
 
 ?>
-- 
cgit v1.2.3