Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open-source
MetaGer
Commits
55fc047a
Commit
55fc047a
authored
4 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
Catching connection error to redis cache in middleware
parent
58f85ea1
No related branches found
No related tags found
3 merge requests
!1645
Development
,
!1643
Development
,
!1630
Resolve "Make the Cache connection optional"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Http/Middleware/HumanVerification.php
+4
-3
4 additions, 3 deletions
app/Http/Middleware/HumanVerification.php
with
4 additions
and
3 deletions
app/Http/Middleware/HumanVerification.php
+
4
−
3
View file @
55fc047a
...
@@ -7,6 +7,7 @@ use Captcha;
...
@@ -7,6 +7,7 @@ use Captcha;
use
Closure
;
use
Closure
;
use
Cookie
;
use
Cookie
;
use
Illuminate\Http\Response
;
use
Illuminate\Http\Response
;
use
Log
;
use
URL
;
use
URL
;
class
HumanVerification
class
HumanVerification
...
@@ -66,7 +67,6 @@ class HumanVerification
...
@@ -66,7 +67,6 @@ class HumanVerification
}
else
{
}
else
{
$user
=
$users
[
$uid
];
$user
=
$users
[
$uid
];
}
}
# Lock out everyone in a Bot network
# Lock out everyone in a Bot network
# Find out how many requests this IP has made
# Find out how many requests this IP has made
$sum
=
0
;
$sum
=
0
;
...
@@ -130,8 +130,10 @@ class HumanVerification
...
@@ -130,8 +130,10 @@ class HumanVerification
}
}
}
}
}
catch
(
\Exception
$e
)
{
Log
::
error
(
$e
->
getMessage
());
}
finally
{
}
finally
{
if
(
$update
)
{
if
(
$update
&&
$user
!=
null
)
{
if
(
$user
[
"whitelist"
])
{
if
(
$user
[
"whitelist"
])
{
$user
[
"expiration"
]
=
now
()
->
addWeeks
(
2
);
$user
[
"expiration"
]
=
now
()
->
addWeeks
(
2
);
}
else
{
}
else
{
...
@@ -148,7 +150,6 @@ class HumanVerification
...
@@ -148,7 +150,6 @@ class HumanVerification
public
function
setUser
(
$prefix
,
$user
)
public
function
setUser
(
$prefix
,
$user
)
{
{
// Lock must be acquired within 2 seconds
$userList
=
Cache
::
get
(
$prefix
.
"."
.
$user
[
"id"
],
[]);
$userList
=
Cache
::
get
(
$prefix
.
"."
.
$user
[
"id"
],
[]);
$userList
[
$user
[
"uid"
]]
=
$user
;
$userList
[
$user
[
"uid"
]]
=
$user
;
Cache
::
put
(
$prefix
.
"."
.
$user
[
"id"
],
$userList
,
2
*
7
*
24
*
60
*
60
);
Cache
::
put
(
$prefix
.
"."
.
$user
[
"id"
],
$userList
,
2
*
7
*
24
*
60
*
60
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment