Finished working on login functionality and fixed some bugs
[speedfreak] / Server / application / controllers / api.php
index 9692244..6b05e45 100644 (file)
@@ -48,27 +48,27 @@ class Api_Controller extends Controller{
         }
         return $xml;
     }
-
+    
     /*
      * Check that supplied credentials are valid using basic authentication
      *
      */
     public function login(){
-       if (isset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])){
-               $user = new User_Model();
-               if ($user->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']))
-                 print "OK";
-               else {
-                 header('HTTP/1.0 401 Unauthorized');
-                 print "Invalid credentials";
-                 die;
-               }
-       }
-       else {
-               header('HTTP/1.0 401 Unauthorized');
+       if (isset($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW'])){
+               $user = new User_Model();
+               if ($user->login($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']))
+                 print "OK";
+               else {
+                 header('HTTP/1.0 401 Unauthorized');
+                 print "Invalid credentials";
+                 die;
+               } 
+       }
+       else {
+               header('HTTP/1.0 401 Unauthorized');
             print "No credentials supplied";
             die;
-       }
-
+       }
+          
     }
 }
\ No newline at end of file