update for API account section, add HTTP status codes for negative response, security fix for empty email code
This commit is contained in:
parent
08bd63ea32
commit
2a3a4ea45b
@ -512,6 +512,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(409);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "company_already_registered",
|
||||
@ -566,6 +567,7 @@ switch($PARAM_1)
|
||||
//echo "<pre>".print_r($arFields, true)."</pre>";
|
||||
//echo $error;
|
||||
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_payload",
|
||||
@ -577,6 +579,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(409);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "company_already_registered",
|
||||
@ -675,6 +678,7 @@ switch($PARAM_1)
|
||||
{
|
||||
//new company
|
||||
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "no_company_for_update",
|
||||
@ -728,6 +732,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_payload",
|
||||
@ -741,6 +746,7 @@ switch($PARAM_1)
|
||||
{
|
||||
//no company
|
||||
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "no_company_for_update",
|
||||
@ -791,6 +797,7 @@ switch($PARAM_1)
|
||||
{
|
||||
if(!in_array($auth['acc_number'], $existed_accounts))
|
||||
{
|
||||
http_response_code(401);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "access_denied",
|
||||
@ -836,6 +843,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "unknown account",
|
||||
@ -845,6 +853,7 @@ switch($PARAM_1)
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
http_response_code(401);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_jwt",
|
||||
@ -855,6 +864,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -891,6 +901,7 @@ switch($PARAM_1)
|
||||
|
||||
default:
|
||||
{
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_user_uri",
|
||||
@ -930,6 +941,7 @@ switch($PARAM_1)
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
http_response_code(401);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_jwt",
|
||||
@ -940,6 +952,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -1054,6 +1067,7 @@ switch($PARAM_1)
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
http_response_code(401);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_jwt",
|
||||
@ -1064,6 +1078,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -1141,6 +1156,7 @@ switch($PARAM_1)
|
||||
}
|
||||
catch(\Exception $e)
|
||||
{
|
||||
http_response_code(401);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_jwt",
|
||||
@ -1151,6 +1167,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -1163,6 +1180,7 @@ switch($PARAM_1)
|
||||
|
||||
default:
|
||||
{
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_admin_uri",
|
||||
@ -2599,6 +2617,8 @@ switch($PARAM_1)
|
||||
$ar_user = $rs_user->Fetch();
|
||||
|
||||
if(is_array($ar_user))
|
||||
{
|
||||
if(!empty($REQ['code']))
|
||||
{
|
||||
if(SEND_EMAIL_PASSWORD_RECOVERY_CODE)
|
||||
{
|
||||
@ -2618,6 +2638,17 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "empty_code",
|
||||
"message" => "Empty code",
|
||||
]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_email",
|
||||
@ -2627,6 +2658,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -2655,6 +2687,7 @@ switch($PARAM_1)
|
||||
|
||||
if($user->LAST_ERROR)
|
||||
{
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_payload",
|
||||
@ -2670,6 +2703,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_email",
|
||||
@ -2679,6 +2713,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -2718,6 +2753,7 @@ switch($PARAM_1)
|
||||
|
||||
if($user->LAST_ERROR)
|
||||
{
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_payload",
|
||||
@ -2733,6 +2769,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "unknow_user",
|
||||
@ -2742,6 +2779,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_email",
|
||||
@ -2751,6 +2789,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -2792,6 +2831,7 @@ switch($PARAM_1)
|
||||
|
||||
if($user->LAST_ERROR)
|
||||
{
|
||||
http_response_code(400);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_payload",
|
||||
@ -2807,6 +2847,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_company",
|
||||
@ -2816,6 +2857,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_email",
|
||||
@ -2825,6 +2867,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
@ -2880,6 +2923,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(401);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_credentials",
|
||||
@ -2934,6 +2978,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(404);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "unknown_user",
|
||||
@ -2943,6 +2988,7 @@ switch($PARAM_1)
|
||||
}
|
||||
else
|
||||
{
|
||||
http_response_code(403);
|
||||
print json_encode([
|
||||
"status" => "error",
|
||||
"error" => "wrong_source",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user