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

Bugfix for when a key is entered

parent 79caee41
No related branches found
No related tags found
1 merge request!1365Resolve "Filter Options for MetaGer"
...@@ -23,6 +23,7 @@ class HumanVerification ...@@ -23,6 +23,7 @@ class HumanVerification
// The specific user // The specific user
$user = null; $user = null;
$newUser = true; $newUser = true;
$update = true;
try { try {
$id = hash("sha512", $request->ip()); $id = hash("sha512", $request->ip());
$uid = hash("sha512", $request->ip() . $_SERVER["AGENT"]); $uid = hash("sha512", $request->ip() . $_SERVER["AGENT"]);
...@@ -35,6 +36,7 @@ class HumanVerification ...@@ -35,6 +36,7 @@ class HumanVerification
* might have to change it at some point. * might have to change it at some point.
*/ */
if ($request->filled('password') || $request->filled('key') || $request->filled('appversion') || !env('BOT_PROTECTION', false)) { if ($request->filled('password') || $request->filled('key') || $request->filled('appversion') || !env('BOT_PROTECTION', false)) {
$update = false;
return $next($request); return $next($request);
} }
...@@ -134,32 +136,34 @@ class HumanVerification ...@@ -134,32 +136,34 @@ class HumanVerification
// Failure in contacting metager3.de // Failure in contacting metager3.de
} finally { } finally {
// Update the user in the database // Update the user in the database
if($newUser){ if($update){
DB::table('humanverification')->insert( if($newUser){
[ DB::table('humanverification')->insert(
'uid' => $user["uid"], [
'id' => $user["id"], 'uid' => $user["uid"],
'unusedResultPages' => $user['unusedResultPages'], 'id' => $user["id"],
'whitelist' => $user["whitelist"], 'unusedResultPages' => $user['unusedResultPages'],
'whitelistCounter' => $user["whitelistCounter"], 'whitelist' => $user["whitelist"],
'locked' => $user["locked"], 'whitelistCounter' => $user["whitelistCounter"],
"lockedKey" => $user["lockedKey"], 'locked' => $user["locked"],
'updated_at' => $user["updated_at"], "lockedKey" => $user["lockedKey"],
] 'updated_at' => $user["updated_at"],
); ]
}else{
DB::table('humanverification')->where('uid', $uid)->update(
[
'uid' => $user["uid"],
'id' => $user["id"],
'unusedResultPages' => $user['unusedResultPages'],
'whitelist' => $user["whitelist"],
'whitelistCounter' => $user["whitelistCounter"],
'locked' => $user["locked"],
"lockedKey" => $user["lockedKey"],
'updated_at' => $user["updated_at"],
]
); );
}else{
DB::table('humanverification')->where('uid', $uid)->update(
[
'uid' => $user["uid"],
'id' => $user["id"],
'unusedResultPages' => $user['unusedResultPages'],
'whitelist' => $user["whitelist"],
'whitelistCounter' => $user["whitelistCounter"],
'locked' => $user["locked"],
"lockedKey" => $user["lockedKey"],
'updated_at' => $user["updated_at"],
]
);
}
} }
} }
$request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]); $request->request->add(['verification_id' => $user["uid"], 'verification_count' => $user["unusedResultPages"]]);
......
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