Fix undefined index E_NOTICE - refs #7338

1.9.x
Angel Fernando Quiroz Campos 10 years ago
parent cce71ec43e
commit 8ee9d1d8de
  1. 4
      main/inc/lib/webservices/WebService.class.php
  2. 4
      webservices/rest.php

@ -46,6 +46,10 @@ abstract class WebService
*/ */
public static function isValidUser($username, $password) public static function isValidUser($username, $password)
{ {
if (empty($username) || empty($password)) {
return false;
}
$userTable = Database::get_main_table(TABLE_MAIN_USER); $userTable = Database::get_main_table(TABLE_MAIN_USER);
$whereConditions = array( $whereConditions = array(

@ -12,12 +12,12 @@ require_once '../main/inc/global.inc.php';
$json = array(); $json = array();
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'nothing'; $action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'nothing';
$username = Security::remove_XSS($_POST['username']); $username = isset($_POST['username']) ? Security::remove_XSS($_POST['username']) : null;
$apiKey = isset($_POST['api_key']) ? Security::remove_XSS($_POST['api_key']) : null; $apiKey = isset($_POST['api_key']) ? Security::remove_XSS($_POST['api_key']) : null;
switch ($action) { switch ($action) {
case 'loginNewMessages': case 'loginNewMessages':
$password = Security::remove_XSS($_POST['password']); $password = isset($_POST['password']) ? Security::remove_XSS($_POST['password']) : null;
if (MessagesWebService::isValidUser($username, $password)) { if (MessagesWebService::isValidUser($username, $password)) {
$webService = new MessagesWebService(); $webService = new MessagesWebService();

Loading…
Cancel
Save