originally i had planned for the username to be the email address and
authorpaulr <me@pjr.cc>
Wed, 2 Nov 2011 15:15:03 +0000 (02:15 +1100)
committerpaulr <me@pjr.cc>
Wed, 2 Nov 2011 15:15:03 +0000 (02:15 +1100)
to have a nick name which was generally visible... until i realised
you cant go http://usernam@email.com@website/ for a login to the git
repo (which you need for git clone http://.../ urls that have logins)

gwvplib/gwvpauth.php
gwvplib/gwvpconfig.php
gwvplib/gwvpdatabase.php
gwvplib/gwvpdebug.php
gwvplib/gwvpsetup.php
gwvplib/gwvpuseradmin.php
unittests/sqlitedb.php

index 27afec8..73107e5 100644 (file)
@@ -51,7 +51,7 @@ function gwvp_RegistrationPageBody()
        <table>
        <tr><td>Name</td><td><input name="name" type="text"></td><td>Your Full Name</td></tr>
        <tr><td>Email</td><td><input name="email" type="text"></td><td>Your Email Address</td></tr>
-       <tr><td>Nick Name</td><td><input name="nickname" type="text"></td><td>The Name Used to Refer to you on the site</td></tr>
+       <tr><td>User Name</td><td><input name="username" type="text"></td><td>The Name Used to Refer to you on the site</td></tr>
        <tr><td><input type="submit" name="register" value="Register"></td></tr>
        </table>
        </form>
index cc0bafd..2c04eab 100644 (file)
@@ -26,7 +26,15 @@ function gwvp_ConfigPage()
 
 function gwvp_ConfigPageBody()
 {
-       
+?>
+<h1>Global Configuration</h1>
+<form method="post">
+<table>
+<tr><td>Allow User Registration</td><td><input type="checkbox" name="allowreg"></td></tr>
+
+</table>
+</form>
+<?php
 }
 
 ?>
\ No newline at end of file
index c2d37cf..267a6e0 100644 (file)
@@ -16,7 +16,7 @@ function gwvp_dbCreateSQLiteStructure($dbloc)
            "users_id" INTEGER PRIMARY KEY AUTOINCREMENT,
            "user_full_name" TEXT,
            "user_password" TEXT,
-           "user_nickname" TEXT,
+           "user_username" TEXT,
            "user_email" TEXT,
            "user_desc" TEXT,
            "user_status" INTEGER
@@ -106,19 +106,19 @@ function gwvp_ConnectDB()
        return $DB_CONNECTION;
 }
 
-function gwvp_createUser($email, $fullname, $password, $nick, $desc, $status)
+function gwvp_createUser($email, $fullname, $password, $username, $desc, $status)
 {
        $conn = gwvp_ConnectDB();
        
        // TODO: change from sha1
        $shapass = sha1($password);
        //error_log("Create user called with $email");
-       $conn->query("insert into users values (null, '$fullname', '$shapass', '$nick', '$email', '$desc', '$status')");
+       $conn->query("insert into users values (null, '$fullname', '$shapass', '$username', '$email', '$desc', '$status')");
        /*
         *          "users_id" INTEGER PRIMARY KEY AUTOINCREMENT,
            "user_full_name" TEXT,
            "user_password" TEXT,
-           "user_nickname" TEXT,
+           "user_username" TEXT,
            "user_email" TEXT,
            "user_desc" TEXT,
            "user_status" INTEGER
@@ -138,7 +138,7 @@ function gwvp_getUsers()
                $returns[$rn]["id"] = $u_res["users_id"];
                $returns[$rn]["fullname"] = $u_res["user_full_name"];
                $returns[$rn]["password"] = $u_res["user_password"];
-               $returns[$rn]["nickname"] = $u_res["user_nickname"];
+               $returns[$rn]["username"] = $u_res["user_username"];
                $returns[$rn]["email"] = $u_res["user_email"];
                $returns[$rn]["desc"] = $u_res["user_desc"];
                $returns[$rn]["status"] = $u_res["user_status"];
@@ -423,13 +423,13 @@ function gwvp_IsUserAdmin($email)
        return false;
 }
 
-function gwvp_ModifyUser($userid, $email=null, $fullname=null, $password=null, $nickname=null, $desc=null, $status=null)
+function gwvp_ModifyUser($userid, $email=null, $fullname=null, $password=null, $username=null, $desc=null, $status=null)
 {
        /*
         *          "users_id" INTEGER PRIMARY KEY AUTOINCREMENT,
            "user_full_name" TEXT,
            "user_password" TEXT,
-           "user_nickname" TEXT,
+           "user_username" TEXT,
            "user_email" TEXT,
            "user_desc" TEXT,
            "user_status" INTEGER
@@ -454,8 +454,8 @@ function gwvp_ModifyUser($userid, $email=null, $fullname=null, $password=null, $
                $conn->query($sql);
        }
 
-       if($nickname != null) {
-               $sql = "update users set user_nickname='$nickname' where users_id='$userid'";
+       if($username != null) {
+               $sql = "update users set user_username='$username' where users_id='$userid'";
                $conn->query($sql);
        }
 
index ae98816..47e630f 100644 (file)
@@ -59,7 +59,7 @@ function gwvp_DebugCall()
                                        header("Location: $BASE_URL/debug");
                                        break;
                                case "createusersandgroups":
-                                       // gwvp_createUser($email, $fullname, $password, $nick, $desc, $status)
+                                       // gwvp_createUser($email, $fullname, $password, $username, $desc, $status)
                                        for($i=20; $i<120; $i++) {
                                                gwvp_createUser("test$i@test.com", "test$i", "asdf", "test$i", "test$i user", 0);
                                        }
index a6d63ac..1116156 100644 (file)
@@ -87,7 +87,7 @@ function gwvp_goSetupGoMain()
        echo "<tr><td>Site Name</td><td><input type=\"text\" name=\"sitename\"></td><td>Some Name for your site</td></tr>";
        echo "<tr><td>First User Full Name</td><td><input type=\"text\" name=\"firstuserfullname\"></td><td>The name of the admin of your site</td></tr>";
        echo "<tr><td>First User email address</td><td><input type=\"text\" name=\"firstuseremail\"></td><td>The email address of the admin of your site (login)</td></tr>";
-       echo "<tr><td>First User Nick Name</td><td><input type=\"text\" name=\"firstusernickname\"></td><td>The name used to idenity the user on the site</td></tr>";
+       echo "<tr><td>First User Username</td><td><input type=\"text\" name=\"firstuserusername\"></td><td>The name used to idenity the user on the site</td></tr>";
        echo "<tr><td>First User Password</td><td><input type=\"text\" name=\"pass1\"></td><td>Password for the user</td></tr>";
        echo "<tr><td>First User Password (confirm)</td><td><input type=\"text\" name=\"pass2\"></td><td>and confirm it...</td></tr>";
        echo "<tr><td>Database Type</td><td><select name=\"dbtype\"><option value=\"sqlite\">SQLite</option></select></td><td>SQLite only at this point</td></tr>";
@@ -119,7 +119,7 @@ function gwvp_goSetupDoInstall()
        $sitename = $_REQUEST["sitename"];
        $fufn = $_REQUEST["firstuserfullname"];
        $fwem = $_REQUEST["firstuseremail"];
-       $fwnick = $_REQUEST["firstusernickname"];
+       $fwusername = $_REQUEST["firstuserusername"];
        $fwpass = $_REQUEST["pass1"];
        $fwpassconf = $_REQUEST["pass2"];
        $dbtype = $_REQUEST["dbtype"];
@@ -132,7 +132,7 @@ function gwvp_goSetupDoInstall()
        echo "<tr><td>Sitename</td><td>$sitename</td></tr>";
        echo "<tr><td>fullname</td><td>$fufn</td></tr>";
        echo "<tr><td>email</td><td>$fwem</td></tr>";
-       echo "<tr><td>nick</td><td>$fwnick</td></tr>";
+       echo "<tr><td>username</td><td>$fwusername</td></tr>";
        echo "<tr><td>pass</td><td>$fwpass</td></tr>";
        echo "<tr><td>passconfirm</td><td>$fwpassconf</td></tr>";
        echo "<tr><td>dbtype</td><td>$dbtype</td></tr>";
index cb5f997..e282fd0 100644 (file)
@@ -61,7 +61,7 @@ function gwvp_UserAdminPageBody()
        echo "<td>Full Name</td><td><input type=\"text\" name=\"fullname\"></td></tr>";
        echo "<tr><td>Password</td><td><input type=\"text\" name=\"pass1\"></td>";
        echo "<td>Password Confirm</td><td><input type=\"text\" name=\"pass2\"></td></tr>";
-       echo "<tr><td>Nickname</td><td><input type=\"text\" name=\"nick\"></td>";
+       echo "<tr><td>Username</td><td><input type=\"text\" name=\"username\"></td>";
        echo "<td>Description</td><td><input type=\"text\" name=\"desc\"></td></tr>";
        echo "<tr><td><input type=\"submit\" name=\"Create\" value=\"Create\" class=\"buttons\"></td></tr>";
        echo "</table>";
@@ -78,9 +78,9 @@ function gwvp_UserAdminPageBody()
        foreach($users as $u_users) {
                $uid = $u_users["id"];
                $email = $u_users["email"];
-               $nickname = $u_users["nickname"];
+               $username = $u_users["username"];
                $fullname = $u_users["fullname"];
-               echo "<option value=\"$uid\">$nickname, $fullname ($email)</option>";
+               echo "<option value=\"$uid\">$username, $fullname ($email)</option>";
        }
        echo "</select></div></td></tr>";
        echo "<tr><td><input type=\"submit\" name=\"Create\" value=\"Create\" class=\"buttons\"></td></tr>";
@@ -93,12 +93,12 @@ function gwvp_UserAdminPageBody()
        // user list
        echo "<tr><td>";
        echo "<table border=\"1\">";
-       echo "<tr><th>EMail</th><th>Nick Name</th><th>Full Name</th><th>In Groups</th><th>Owns Groups</th><th>Description</th><th>Admin?</th><th>Status</th></tr>";
+       echo "<tr><th>EMail</th><th>Username</th><th>Full Name</th><th>In Groups</th><th>Owns Groups</th><th>Description</th><th>Admin?</th><th>Status</th></tr>";
        /*
         *              $returns[$rn]["id"] = $u_res["users_id"];
                $returns[$rn]["fullname"] = $u_res["user_full_name"];
                $returns[$rn]["password"] = $u_res["user_password"];
-               $returns[$rn]["nickname"] = $u_res["user_nickname"];
+               $returns[$rn]["username"] = $u_res["user_username"];
                $returns[$rn]["email"] = $u_res["user_email"];
                $returns[$rn]["desc"] = $u_res["user_desc"];
                $returns[$rn]["status"] = $u_res["user_status"];
@@ -107,7 +107,7 @@ function gwvp_UserAdminPageBody()
        foreach($users as $u_users) {
                $email = $u_users["email"];
                $fullname = $u_users["fullname"];
-               $nickname = $u_users["nickname"];
+               $username = $u_users["username"];
                $desc = $u_users["desc"];
                $status = $u_users["status"];
                if(gwvp_IsUserAdmin($email) == 1) {
@@ -132,7 +132,7 @@ function gwvp_UserAdminPageBody()
                        }
                }
                
-               echo "<tr><td>$email</td><td>$nickname</td><td>$fullname</td><td>$ugroups</td><td>$ogroups</td><td>$desc</td><td>$globaladmin</td><td>$status</td></tr>";
+               echo "<tr><td>$email</td><td>$username</td><td>$fullname</td><td>$ugroups</td><td>$ogroups</td><td>$desc</td><td>$globaladmin</td><td>$status</td></tr>";
        }
        echo "</table>";
        
index c5c0d37..3b99eb2 100644 (file)
@@ -23,11 +23,11 @@ gwvp_dbCreateSQLiteStructure("$db_name");
 
 gwvp_ConnectDB();
 
-// function gwvp_createUser($email, $fullname, $password, $nick, $desc, $status)
+// function gwvp_createUser($email, $fullname, $password, $username, $desc, $status)
 // test users creation
-gwvp_createUser("test@test.com", "test user", "password", "nick", "desc", "0");
-gwvp_createUser("test2@test.com", "test2 user", "password", "nick2", "desc2", "0");
-gwvp_createUser("test3@test.com", "test2 user", "password", "nick2", "desc2", "0");
+gwvp_createUser("test@test.com", "test user", "password", "username", "desc", "0");
+gwvp_createUser("test2@test.com", "test2 user", "password", "username2", "desc2", "0");
+gwvp_createUser("test3@test.com", "test2 user", "password", "usernme3", "desc2", "0");
 $users = gwvp_getUsers();
 echo "Users\n";
 echo "\tCreate test@test.com\n";