fix login

This commit is contained in:
CHIEFSOFT\ameye
2024-07-07 19:12:49 -04:00
parent 8394788967
commit b8f237dfe5
+16 -9
View File
@@ -18,8 +18,20 @@ class WrenchAuth extends BaseController
$in["login_mode"] = MOBILE_LOGIN;
}
// make safe for redis
$outF["username"] = str_replace("@", "_", $in["username"]);
$outF["username"] = str_replace(".", "_", $outF["username"]);
$outF["original_username"] = $in["username"];
$outF["loc"] = $in["loc"];
$fail_endpoint = "LOGIN_FAILED-".$outF["username"]."-";
//===================REDIS DATA IN CASE OF FAIL
$out_redis = $this->getCache($fail_endpoint); // try find in cache
if ( isset($out_redis) && isset($out_redis["fail_count"]) && $out_redis["fail_count"] > 2 ){
// we need stop here
}
$out=[];
// $out = $this->getCache($endpoint); // try find in cache
$ret = $this->wrenchboard->wrenchboard_api($in, $out);
$out['internal_return'] = $ret;
log_message('critical', "***** ***** WrenchAuth::userLogin Ret = ".$ret );
@@ -29,14 +41,9 @@ class WrenchAuth extends BaseController
$this->saveCache($endpoint,$out,15000);
}else
{
// make safe for redis
$outF["username"] = str_replace("@", "_", $in["username"]);
$outF["username"] = str_replace(".", "_", $outF["username"]);
$outF["loc"] = $in["loc"];
$endpoint = "LOGIN_FAILED-".$outF["username"]."-";
log_message('critical', "***** ***** WrenchAuth::userLogin USER_SESSION = ".$endpoint );
$this->saveCache($endpoint,$outF,15000);
$outF["fail_count"] = isset( $out_redis["fail_count"] ) ? $out_redis["fail_count"]+1:1;
log_message('critical', "***** ***** WrenchAuth::userLogin USER_SESSION = ".$fail_endpoint );
$this->saveCache($fail_endpoint,$outF,15000);
}
// }