Commit e86bd4ea authored by Dominik Hebeler's avatar Dominik Hebeler

Merge branch '957-new-captcha-texts' into 'development'

Resolve "New Captcha Texts"

Closes #957

See merge request !1573
parents 008fc54f dc787fd2
......@@ -33,7 +33,7 @@ class HumanVerification extends Controller
}
if ($request->getMethod() == 'POST') {
\App\PrometheusExporter::CaptchaAnswered();
$lockedKey = $user["lockedKey"];
$key = $request->input('captcha');
$key = strtolower($key);
......@@ -42,7 +42,7 @@ class HumanVerification extends Controller
$captcha = Captcha::create("default", true);
$user["lockedKey"] = $captcha["key"];
HumanVerification::saveUser($user);
\App\PrometheusExporter::CaptchaShown();
return view('humanverification.captcha')->with('title', 'Bestätigung notwendig')
->with('uid', $user["uid"])
->with('id', $id)
......@@ -50,6 +50,7 @@ class HumanVerification extends Controller
->with('image', $captcha["img"])
->with('errorMessage', 'Fehler: Falsche Eingabe!');
} else {
\App\PrometheusExporter::CaptchaCorrect();
# If we can unlock the Account of this user we will redirect him to the result page
if ($user !== null && $user["locked"]) {
# The Captcha was correct. We can remove the key from the user
......@@ -67,7 +68,7 @@ class HumanVerification extends Controller
$captcha = Captcha::create("default", true);
$user["lockedKey"] = $captcha["key"];
HumanVerification::saveUser($user);
\App\PrometheusExporter::CaptchaShown();
return view('humanverification.captcha')->with('title', 'Bestätigung notwendig')
->with('uid', $user["uid"])
->with('id', $id)
......
......@@ -102,6 +102,7 @@ class HumanVerification
if ($user["locked"]) {
$captcha = Captcha::create("default", true);
$user["lockedKey"] = $captcha["key"];
\App\PrometheusExporter::CaptchaShown();
return
new Response(
view('humanverification.captcha')
......
<?php
namespace App;
class PrometheusExporter {
public static function CaptchaShown() {
$registry = \Prometheus\CollectorRegistry::getDefault();
$counter = $registry->getOrRegisterCounter('metager', 'captcha_shown', 'counts how often the captcha was shown', []);
$counter->inc();
}
public static function CaptchaCorrect() {
$registry = \Prometheus\CollectorRegistry::getDefault();
$counter = $registry->getOrRegisterCounter('metager', 'captcha_correct', 'counts how often the captcha was solved correctly', []);
$counter->inc();
}
public static function CaptchaAnswered() {
$registry = \Prometheus\CollectorRegistry::getDefault();
$counter = $registry->getOrRegisterCounter('metager', 'captcha_answered', 'counts how often the captcha was answered', []);
$counter->inc();
}
}
\ No newline at end of file
......@@ -34,6 +34,17 @@ class AppServiceProvider extends ServiceProvider
\App::setLocale('es');
}
\Prometheus\Storage\Redis::setDefaultOptions(
[
'host' => env("REDIS_HOST", '127.0.0.1'),
'port' => intval(env("REDIS_PORT", 6379)),
'password' => env("REDIS_PASSWORD", null),
'timeout' => 0.1, // in seconds
'read_timeout' => '10', // in seconds
'persistent_connections' => false
]
);
Queue::before(function (JobProcessing $event) {
});
Queue::after(function (JobProcessed $event) {
......
......@@ -14,11 +14,11 @@ services:
dependencies:
depends_on:
- "mgdb"
image: php:7.3-cli
image: php:7.3-cli-alpine
volumes:
- .:/data
working_dir: /data
command: /data/init.sh
command: /bin/sh -c "apk add --update dos2unix && dos2unix ./init.sh && ./init.sh && ./init.sh"
mgdb:
restart: on-failure
image: mariadb:latest
......
......@@ -12,6 +12,10 @@ if [ -f "/data/database/useragents.sqlite" ]; then
rm /data/database/useragents.sqlite
fi
if [ ! -d "/data/storage/logs/metager" ]; then
mkdir -p /data/storage/logs/metager
fi
touch /data/database/useragents.sqlite
chmod -R go+w storage bootstrap/cache
......
......@@ -6,6 +6,4 @@ return [
'4' => 'Bitte geben Sie deshalb die Zeichen aus dem Bild in die Eingabebox und bestätigen Sie mit "OK" um zur Ergebnisseite zu gelangen.',
'5' => 'Captcha eingeben',
'6' => 'Wochentag eingeben',
'7' => 'Sollten Sie diese Nachricht häufiger sehen oder handelt es sich dabei um einen Irrtum, schicken Sie uns gerne eine Nachricht über unser <a href=":url">Kontaktformular</a>.',
'8' => 'Nennen Sie uns in diesem Fall bitte unbedingt folgende Vorgangsnummer:',
];
......@@ -6,6 +6,4 @@ return [
'4' => 'Please enter the characters from the picture in the input box and confirm with "OK" to get to the result page.',
'5' => 'Enter captcha',
'6' => 'Enter weekday',
'7' => 'If you see this message more often, or if it is a mistake, feel free to send a message via our <a href=":url"> contact form </a>.',
'8' => 'In this case, please give us the following transaction number:',
];
......@@ -6,6 +6,4 @@ return [
'4' => 'Ingrese los caracteres de la imagen en el cuadro de entrada y confirme con "OK" para llegar a la página de resultados.',
'5' => 'Entrar en captcha',
'6' => 'Entrar en día laborable',
'7' => 'Si ve este mensaje con más frecuencia o si es un error, puede enviar un mensaje a través de nuestro <a href=":url"> formulario de contacto </a>.',
'8' => 'En este caso, por favor dénos el siguiente número de transacción:',
];
......@@ -18,6 +18,4 @@
<p><input type="text" class="form-control" name="captcha" placeholder="@lang('captcha.5')" autofocus></p>
<p><button type="submit" class="btn btn-success" name="check">OK</button></p>
</form>
<p>@lang('captcha.7', ['url' => LaravelLocalization::getLocalizedURL(LaravelLocalization::getCurrentLocale(), 'kontakt')])</p>
<p>@lang('captcha.8') {{ $id }}
@endsection
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment