Nathaniel van Diepen 9 years ago
parent
commit
054fb5dfcd
3 changed files with 5 additions and 5 deletions
  1. 1 2
      lib/irc.php
  2. 1 1
      lib/security.php
  3. 3 2
      site/api/index.php

+ 1 - 2
lib/irc.php

@@ -25,7 +25,6 @@
 		$message->addParam(new xmlrpcval($password, "string"));
 		$client = new xmlrpc_client($path, $hostname, $port);
 		$response = $client->send($message);
-
 		$session = NULL;
 		if(!$response->faultCode()){
 			$session = explode("<string>", $response->serialize());
@@ -48,7 +47,7 @@
 				default:
 					$m = __("Could not log in");
 			}
-			return array(false,$m,$response->faultCode());
+			return array(false,$m,$response->faultCode(),$response->faultString());
 		}
 		$message = new xmlrpcmsg("atheme.command");
 		$message->addParam(new xmlrpcval($session, "string"));

+ 1 - 1
lib/security.php

@@ -60,7 +60,7 @@
 				setcookie('type','user',null,'/');
 				return true;
 			}else{
-				return __("Invalid credentials");
+				return __("Could not log in: ").@$user[1].": ".@$user[3];
 			}
 		}elseif($type=='persona'){
 			if(!$user = get_user_obj($nick,$effective_role)){

+ 3 - 2
site/api/index.php

@@ -1,4 +1,5 @@
 <?php
+	error_reporting(E_ERROR);
 	header('Content-type: application/json');
 	header('Access-Control-Allow-Origin: *');
 	require_once("../../header.php");
@@ -22,7 +23,7 @@
 			isset($_GET['type']) or die('{"code":2,"message":"'.__('Missing user type').'"}');
 			$r = login($_GET['username'],$_GET['password'],$_GET['type']);
 			if($r !== true){
-				die('{"code":2,"message":"'.$r.'"}');
+				die('{"code":2,"message":'.json_encode($r).'}');
 			}else{
 				die('{"code":0}');
 			}
@@ -122,9 +123,9 @@
 							$chan['canaccess'] = true;
 						}
 						$res2 = atheme_command(get_conf('xmlrpc-server'),get_conf('xmlrpc-port'),get_conf('xmlrpc-path'),USER_IP,$_COOKIE['user'],$_SESSION['password'],'ChanServ','flags',array($name));
+						$users = array();
 						if($res2[0]){
 							$res2 = explode('&#10;',$res2[1]);
-							$users = array();
 							foreach($res2 as $kk => $row2){
 								if($kk > 1 && $kk < count($res2)-2){
 									$user = array(