moved the old git poc code off and away from the main directory
[gwvp.git] / gwvplib / gwvpauth.php
index 5056c06..2602256 100644 (file)
@@ -37,10 +37,10 @@ function gwvp_AuthCallMe()
 
 function gwvp_AskForBasicAuth()
 {
+       error_log("AUTH: asking for basic auth");
        if(!isset($_SERVER["PHP_AUTH_USER"])) {
-               header('WWW-Authenticate: Basic realm="My Realm"');
-               header('HTTP/1.0 401 Unauthorized');
-               exit(0);
+               header('WWW-Authenticate: Basic realm="GIT Repo"');
+               header('HTTP/1.1 401 Unauthorized');
        } else return; 
 }
 
@@ -59,12 +59,6 @@ function gwvp_CheckAuthLevel($levels)
        return false;
 }
 
-function gwvp_fourZeroThree()
-{
-       header("HTTP/1.0 403 Permission Denied");
-       exit(0);
-}
-
 function gwvp_AuthNoPerms()
 {
        gwvp_goMainPage("gwvp_AuthNoPermsBody");
@@ -210,7 +204,13 @@ function gwvp_checkBasicAuthLogin()
                $pass = $_SERVER["PHP_AUTH_PW"];
        } else return false;
        
-       return gwvp_authUserPass($user, $pass);
+       error_log("passing basic auth for $user, $pass to backend");
+       $auth = gwvp_authUserPass($user, $pass);
+       if($auth !== false) {
+               error_log("auth passes");
+       }
+       
+       return $auth;
 }
 
 function gwvp_IsLoggedIn()
@@ -229,7 +229,7 @@ function gwvp_SingleLineLoginForm()
        echo "<form method=\"post\" action=\"$BASE_URL/login\">Username <input type=\"text\" name=\"username\" class=\"login\">";
        echo " Passowrd <input type=\"text\" name=\"password\" class=\"login\"><input type=\"submit\" name=\"login\" value=\"Login\" class=\"loginbutton\">";
        if(gwvp_IsRegistrationEnabled()) echo "<a href=\"$BASE_URL/register\">Register</a></form>";
-       else echo "</form>";
+       else echo "</form><br>";
 }