Skip to content

Commit

Permalink
FCBHDBP-298 It has added the captcha field to API Key Request Form. I…
Browse files Browse the repository at this point in the history
…t has added new env parameters to set the cache key values.
  • Loading branch information
vichugofsl committed Feb 8, 2022
1 parent 9f198d0 commit 3a784ce
Show file tree
Hide file tree
Showing 11 changed files with 239 additions and 123 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ SENTRY_DSN=

# Google Services
# -----------------------------------

CHECKBOX_RECAPTCHA_SITEKEY=
CHECKBOX_RECAPTCHA_SECRETKEY=
INVISIBLE_RECAPTCHA_SITEKEY=
INVISIBLE_RECAPTCHA_SECRETKEY=
INVISIBLE_RECAPTCHA_BADGEHIDE=
Expand Down
3 changes: 2 additions & 1 deletion .env.travis
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ NULL_IP_ADDRESS=0.0.0.0

# Google Services
# -----------------------------------

CHECKBOX_RECAPTCHA_SITEKEY=
CHECKBOX_RECAPTCHA_SECRETKEY=
INVISIBLE_RECAPTCHA_SITEKEY=
INVISIBLE_RECAPTCHA_SECRETKEY=
INVISIBLE_RECAPTCHA_BADGEHIDE=
Expand Down
15 changes: 8 additions & 7 deletions app/Http/Controllers/ApiKey/KeysController.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ public function request(Request $request)
return view('api_key.request_key');
}
$rules = [
'name' => 'required|string',
'application_name' => 'required|string',
'application_url' => 'required|string',
'email' => 'required|email',
'description' => 'required|string',
'question' => 'string',
'agreement' => 'required'
'name' => 'required|string',
'application_name' => 'required|string',
'application_url' => 'required|string',
'email' => 'required|email',
'description' => 'required|string',
'question' => 'string',
'agreement' => 'required',
'g-recaptcha-response' => 'recaptcha'
];

$validator = Validator::make(request()->all(), $rules);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Plan/PlansController.php
Original file line number Diff line number Diff line change
Expand Up @@ -955,7 +955,7 @@ public function translate(Request $request, $plan_id, $user = null, $compare_pro
if ($show_text) {
$show_details = $show_text;
}

$plan = $this->plan_service->translate($plan_id, $bible, $user_id, $draft, $save_completed_items);

if ($show_details === true) {
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"algolia/algoliasearch-client-php": "3.2.0",
"appstract/laravel-opcache": "4.0.2",
"aws/aws-sdk-php-laravel": "3.6.0",
"biscolab/laravel-recaptcha": "^5.2",
"bugsnag/bugsnag-laravel": "2.22.2",
"curl/curl": "2.3.3",
"doctrine/dbal": "3.2.1",
Expand Down
74 changes: 72 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
App\Providers\BroadcastServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
// Laravel\Socialite\SocialiteServiceProvider::class,
SocialiteProviders\Manager\ServiceProvider::class,
SocialiteProviders\Generators\GeneratorsServiceProvider::class,
Illuminate\Notifications\NotificationServiceProvider::class,
Expand All @@ -172,6 +171,7 @@
App\Providers\LocalEnvironmentServiceProvider::class,
Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class,
Sentry\Laravel\ServiceProvider::class,
Biscolab\ReCaptcha\ReCaptchaServiceProvider::class,
],

/*
Expand Down Expand Up @@ -225,7 +225,8 @@
'Localization' => Lunaweb\Localization\Facades\Localization::class,
'i18n' => Lunaweb\Localization\Facades\Localization::class,
'Bugsnag' => Bugsnag\BugsnagLaravel\Facades\Bugsnag::class,
'Sentry' => Sentry\Laravel\Facade::class,
'Sentry' => Sentry\Laravel\Facade::class,
'ReCaptcha' => Biscolab\ReCaptcha\Facades\ReCaptcha::class
],

];
32 changes: 32 additions & 0 deletions config/recaptcha.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

return [
'api_site_key' => env('CHECKBOX_RECAPTCHA_SITEKEY', ''),
'api_secret_key' => env('CHECKBOX_RECAPTCHA_SECRETKEY', ''),
// changed in v4.0.0
'version' => 'v2', // supported: "v3"|"v2"|"invisible"
// @since v3.4.3 changed in v4.0.0
'curl_timeout' => 10,
'skip_ip' => [], // array of IP addresses - String: dotted quad format e.g.: "127.0.0.1"
// @since v3.2.0 changed in v4.0.0
'default_validation_route' => 'biscolab-recaptcha/validate',
// @since v3.2.0 changed in v4.0.0
'default_token_parameter_name' => 'token',
// @since v3.6.0 changed in v4.0.0
'default_language' => null,
// @since v4.0.0
'default_form_id' => 'biscolab-recaptcha-invisible-form', // Only for "invisible" reCAPTCHA
// @since v4.0.0
'explicit' => false, // true|false
// @since v4.3.0
'api_domain' => "www.google.com", // default value is "www.google.com"
// @since v4.0.0
'tag_attributes' => [
'theme' => 'light', // "light"|"dark"
'size' => 'normal', // "normal"|"compact"
'tabindex' => 0,
'callback' => null, // DO NOT SET "biscolabOnloadCallback"
'expired-callback' => null, // DO NOT SET "biscolabOnloadCallback"
'error-callback' => null, // DO NOT SET "biscolabOnloadCallback"
]
];
1 change: 0 additions & 1 deletion config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,5 +91,4 @@
'fonts_server' => env('CDN_FONTS_SERVER', 'cdn.bible.build'),
'country_image_server' => env('MCDN_COUNTRY_IMAGE', 'dbp-mcdn.s3.us-west-2.amazonaws.com')
]

];
17 changes: 16 additions & 1 deletion resources/views/api_key/request_key.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@extends('layouts.apiKey')
@section('head')
<title>Request your API key</title>
{!! htmlScriptTagJsApi(['lang' => 'en']) !!}
@endsection

@section('content')
Expand All @@ -9,10 +10,14 @@
<h1 class="txt-h2">Request Your API Key</h1>
</div>
</div>

<div class="section">
<div class="api-form-container">
<div class="form-single-col__container w-form">
@if($errors->has('g-recaptcha-response'))
<div class="full-col__input-wrapper mb-24">
<p class="card-header notification is-danger is-danger is-light">Captcha Required</p>
</div>
@endif
<form id="key_request" method="POST" name="wf-form-API-Key-Request" data-name="API Key Request" class="form-single-col" action="{{ route('api_key.request') }}">
@csrf <!-- add csrf field on your form -->
<div class="full-col__input-wrapper mb-24">
Expand Down Expand Up @@ -49,6 +54,16 @@
</span>
</label>
</div>
@if($errors->has('g-recaptcha-response'))
<div class="full-col__input-wrapper align-center mb-24">
<span class="help-block notification is-danger is-light">
Error verifying Captcha, please try again.
</span>
</div>
@endif
<div class="full-col__input-wrapper align-center mb-24">
{!! htmlFormSnippet() !!}
</div>
<div class="full-col__input-wrapper align-center">
<input type="submit" value="Submit" data-wait="Please wait..." class="btn-md btn--send mb-40 w-button">
</div>
Expand Down
Loading

0 comments on commit 3a784ce

Please sign in to comment.