Skip to content
Snippets Groups Projects
Commit 1ad52dfa authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '938-humanverification-seems-to-be-not-resetting' into 'development'

Resolve "Humanverification seems to be not resetting"

Closes #938

See merge request !1519
parents 1a94a3e8 485f804b
No related branches found
No related tags found
2 merge requests!1520Development,!1519Resolve "Humanverification seems to be not resetting"
...@@ -4,6 +4,8 @@ APP_LOG_LEVEL=debug ...@@ -4,6 +4,8 @@ APP_LOG_LEVEL=debug
APP_KEY= APP_KEY=
APP_URL=http://localhost APP_URL=http://localhost
BOT_PROTECTION=true
DB_CONNECTION=mysql DB_CONNECTION=mysql
DB_HOST=mgdb DB_HOST=mgdb
DB_PORT=3306 DB_PORT=3306
......
...@@ -92,9 +92,9 @@ class HumanVerification extends Controller ...@@ -92,9 +92,9 @@ class HumanVerification extends Controller
public static function removeGet(Request $request, $mm, $password, $url) public static function removeGet(Request $request, $mm, $password, $url)
{ {
$url = base64_decode(str_replace("<<SLASH>>", "/", $url)); $url = base64_decode(str_replace("<<SLASH>>", "/", $url));
# If the user is correct and the password is we will delete any entry in the database # If the user is correct and the password is we will delete any entry in the database
$requiredPass = md5($mm . Carbon::NOW()->day . $url . env("PROXY_PASSWORD")); $requiredPass = md5($mm . Carbon::NOW()->day . $url . env("PROXY_PASSWORD"));
if (HumanVerification::checkId($request, $mm) && $requiredPass === $password) { if (HumanVerification::checkId($request, $mm) && $requiredPass === $password) {
HumanVerification::removeUser($request, $mm); HumanVerification::removeUser($request, $mm);
} }
...@@ -126,8 +126,13 @@ class HumanVerification extends Controller ...@@ -126,8 +126,13 @@ class HumanVerification extends Controller
$changed = true; $changed = true;
} }
} }
if ($changed) { if ($changed) {
Cache::put(HumanVerification::PREFIX . "." . $user["id"], $userList, now()->addWeeks(2)); if (sizeof($newUserList) > 0) {
Cache::put(HumanVerification::PREFIX . "." . $user["id"], $newUserList, now()->addWeeks(2));
} else {
Cache::forget(HumanVerification::PREFIX . "." . $user["id"], $newUserList);
}
} }
} }
...@@ -152,11 +157,10 @@ class HumanVerification extends Controller ...@@ -152,11 +157,10 @@ class HumanVerification extends Controller
$sum = 0; $sum = 0;
foreach ($userlist as $uidTmp => $userTmp) { foreach ($userlist as $uidTmp => $userTmp) {
if (!empty($userTmp) && !empty($userTmp["whitelist"]) && !$userTmp["whitelist"]) { if (!empty($userTmp) && gettype($userTmp["whitelist"]) === "boolean" && !$userTmp["whitelist"]) {
$sum += intval($userTmp["unusedResultPages"]); $sum += intval($userTmp["unusedResultPages"]);
} }
} }
# Check if we have to whitelist the user or if we can simply delete the data # Check if we have to whitelist the user or if we can simply delete the data
if ($user["unusedResultPages"] < $sum && !$user["whitelist"]) { if ($user["unusedResultPages"] < $sum && !$user["whitelist"]) {
# Whitelist # Whitelist
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment