Skip to content
GitLab
Menu
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
0d767158
Commit
0d767158
authored
Aug 02, 2022
by
Dominik Hebeler
Browse files
Extracted correct solution from generated captcha
parent
474637c8
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
metager/app/Http/Controllers/HumanVerification.php
View file @
0d767158
...
...
@@ -4,9 +4,10 @@ namespace App\Http\Controllers;
use
App\Models\Verification\CookieVerification
;
use
App\Models\Verification\HumanVerification
as
ModelsHumanVerification
;
use
Captcha
;
use
App\Models\Verification\
Captcha
;
use
Carbon
;
use
Cookie
;
use
Crypt
;
use
Illuminate\Hashing\BcryptHasher
as
Hasher
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\Cache
;
...
...
@@ -39,13 +40,30 @@ class HumanVerification extends Controller
return
redirect
(
$redirect_url
);
}
$captcha
=
Captcha
::
create
(
"default"
,
true
);
$captcha
=
new
Captcha
(
app
(
'Illuminate\Filesystem\Filesystem'
),
app
(
'Illuminate\Contracts\Config\Repository'
),
app
(
'Intervention\Image\ImageManager'
),
app
(
'Illuminate\Session\Store'
),
app
(
'Illuminate\Hashing\BcryptHasher'
),
app
(
'Illuminate\Support\Str'
)
);
$captcha_key
=
$captcha
->
create
(
'default'
,
true
);
// Extract the correct solution to this captcha for generating the Audio Captcha
$text
=
implode
(
" "
,
$captcha
->
getText
());
$key
=
Crypt
::
decrypt
(
$captcha_key
[
"key"
]);
# $captcha = Captcha::create("default", true);
# $key = Crypt::decrypt($captcha["key"]);
\
App\PrometheusExporter
::
CaptchaShown
();
return
view
(
'humanverification.captcha'
)
->
with
(
'title'
,
'Bestätigung notwendig'
)
->
with
(
'url'
,
$redirect_url
)
->
with
(
'correct'
,
$captcha
[
"key"
])
->
with
(
'image'
,
$captcha
[
"img"
])
->
with
(
'correct'
,
$captcha
_key
[
"key"
])
->
with
(
'image'
,
$captcha
_key
[
"img"
])
->
with
(
'css'
,
[
mix
(
'css/verify/index.css'
)]);
}
...
...
metager/app/Models/Verification/Captcha.php
0 → 100644
View file @
0d767158
<?php
namespace
App\Models\Verification
;
use
Mews\Captcha\Captcha
as
CaptchaCaptcha
;
class
Captcha
extends
CaptchaCaptcha
{
public
function
getText
()
{
return
$this
->
text
;
}
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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