Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/cydrobolt/polr.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/Http/Controllers/UserController.php')
-rw-r--r--app/Http/Controllers/UserController.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/Http/Controllers/UserController.php b/app/Http/Controllers/UserController.php
index 4d4a34c..7cdf545 100644
--- a/app/Http/Controllers/UserController.php
+++ b/app/Http/Controllers/UserController.php
@@ -57,6 +57,18 @@ class UserController extends Controller {
return redirect(route('index'))->with('error', 'Sorry, but registration is disabled.');
}
+ if (env('POLR_ACCT_CREATION_RECAPTCHA')) {
+ // Verify reCAPTCHA if setting is enabled
+ $gRecaptchaResponse = $request->input('g-recaptcha-response');
+
+ $recaptcha = new \ReCaptcha\ReCaptcha(env('POLR_RECAPTCHA_SECRET_KEY'));
+ $recaptcha_resp = $recaptcha->verify($gRecaptchaResponse, $request->ip());
+
+ if (!$recaptcha_resp->isSuccess()) {
+ return redirect(route('signup'))->with('error', 'You must complete the reCAPTCHA to register.');
+ }
+ }
+
// Validate signup form data
$this->validate($request, [
'username' => 'required|alpha_dash',