Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
MetaGer
Commits
172b0fd3
Commit
172b0fd3
authored
Feb 27, 2019
by
Dominik Hebeler
Browse files
Fixed Botprotection
parent
cab04187
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
app/Http/Controllers/HumanVerification.php
View file @
172b0fd3
...
...
@@ -51,6 +51,7 @@ class HumanVerification extends Controller
->
with
(
'id'
,
$id
)
->
with
(
'url'
,
$url
)
->
with
(
'image'
,
$captcha
[
"img"
]);
}
public
static
function
remove
(
Request
$request
)
...
...
app/Http/Middleware/HumanVerification.php
View file @
172b0fd3
...
...
@@ -35,7 +35,7 @@ class HumanVerification
* If someone that uses a bot finds this out we
* might have to change it at some point.
*/
if
(
$request
->
filled
(
'password'
)
||
$request
->
filled
(
'key'
)
||
$request
->
filled
(
'appversion'
)
||
!
env
(
'BOT_PROTECTION'
,
false
))
{
if
(
$request
->
has
(
'password'
)
||
$request
->
has
(
'key'
)
||
$request
->
has
(
'appversion'
)
||
!
env
(
'BOT_PROTECTION'
,
false
))
{
$update
=
false
;
return
$next
(
$request
);
}
...
...
@@ -126,10 +126,8 @@ class HumanVerification
# The user currently isn't locked
# We have different security gates:
# 50
, 75, 85, >=90
=> Captcha validated Result Pages
# 50
and then every 25
=> Captcha validated Result Pages
# If the user shows activity on our result page the counter will be deleted
# Maybe I'll add a ban if the user reaches 100
if
(
$user
[
"unusedResultPages"
]
===
50
||
(
$user
[
"unusedResultPages"
]
>
50
&&
$user
[
"unusedResultPages"
]
%
25
===
0
))
{
$user
[
"locked"
]
=
true
;
}
...
...
@@ -138,8 +136,8 @@ class HumanVerification
}
catch
(
\
Illuminate\Database\QueryException
$e
)
{
// Failure in contacting metager3.de
}
finally
{
// Update the user in the database
if
(
$update
)
{
// Update the user in the database
if
(
$newUser
)
{
DB
::
table
(
'humanverification'
)
->
insert
(
[
...
...
@@ -171,5 +169,6 @@ class HumanVerification
}
$request
->
request
->
add
([
'verification_id'
=>
$user
[
"uid"
],
'verification_count'
=>
$user
[
"unusedResultPages"
]]);
return
$next
(
$request
);
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment