mirror of
https://github.com/openclassify/openclassify.git
synced 2026-01-11 18:01:10 -06:00
Merge pull request #779 from openclassify/dia
remove unused properties and methods
This commit is contained in:
commit
0956c22ad3
@ -31,6 +31,7 @@ return [
|
|||||||
'hide_standard_price_field',
|
'hide_standard_price_field',
|
||||||
'hide_options_field',
|
'hide_options_field',
|
||||||
'listing_page_image',
|
'listing_page_image',
|
||||||
|
'show_breadcrumb_when_creating_ad',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
'ads_image' => [
|
'ads_image' => [
|
||||||
|
|||||||
@ -290,4 +290,11 @@ return [
|
|||||||
'default_value' => 5,
|
'default_value' => 5,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'show_breadcrumb_when_creating_ad' => [
|
||||||
|
'type' => 'anomaly.field_type.boolean',
|
||||||
|
'config' => [
|
||||||
|
'default_value' => true,
|
||||||
|
'mode' => 'checkbox'
|
||||||
|
],
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -179,5 +179,8 @@ return [
|
|||||||
'user_filter_limit' => [
|
'user_filter_limit' => [
|
||||||
'name' => 'User Filter Limit',
|
'name' => 'User Filter Limit',
|
||||||
'instructions' => 'In the admin panel'
|
'instructions' => 'In the admin panel'
|
||||||
]
|
],
|
||||||
|
'show_breadcrumb_when_creating_ad' => [
|
||||||
|
'name' => 'Show Breadcrumb When Creating an Ad',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<section class="clearfix ad-post-page">
|
<section class="clearfix ad-post-page">
|
||||||
{% include "visiosoft.module.advs::new-ad/partials/breadcrumb" %}
|
{% if setting_value('visiosoft.module.advs::show_breadcrumb_when_creating_ad') %}
|
||||||
|
{% include "visiosoft.module.advs::new-ad/partials/breadcrumb" %}
|
||||||
|
{% endif %}
|
||||||
<div id="ad-cat-section" class="border rounded shadow-sm bg-light py-4 px-3">
|
<div id="ad-cat-section" class="border rounded shadow-sm bg-light py-4 px-3">
|
||||||
<h5 class="mb-3">
|
<h5 class="mb-3">
|
||||||
<img src="{{ img('visiosoft.module.advs::images/ascend.svg').url }}" class="step-icon mr-1">
|
<img src="{{ img('visiosoft.module.advs::images/ascend.svg').url }}" class="step-icon mr-1">
|
||||||
|
|||||||
@ -10,6 +10,7 @@ use Visiosoft\AdvsModule\Adv\AdvRepository;
|
|||||||
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
use Anomaly\Streams\Platform\Model\Advs\AdvsAdvsEntryModel;
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
||||||
|
use Visiosoft\AdvsModule\Adv\Listeners\AddTableCategoryColumn;
|
||||||
use Visiosoft\AdvsModule\Http\Middleware\redirectDiffrentLang;
|
use Visiosoft\AdvsModule\Http\Middleware\redirectDiffrentLang;
|
||||||
use Visiosoft\AdvsModule\Http\Middleware\SetLang;
|
use Visiosoft\AdvsModule\Http\Middleware\SetLang;
|
||||||
use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript;
|
use Visiosoft\AdvsModule\Listener\AddAdvsSettingsScript;
|
||||||
@ -33,42 +34,10 @@ use Visiosoft\LocationModule\Country\CountryRepository;
|
|||||||
|
|
||||||
class AdvsModuleServiceProvider extends AddonServiceProvider
|
class AdvsModuleServiceProvider extends AddonServiceProvider
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional addon plugins.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $plugins = [
|
protected $plugins = [
|
||||||
AdvsModulePlugin::class,
|
AdvsModulePlugin::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon Artisan commands.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $commands = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon's scheduled commands.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $schedules = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon API routes.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $api = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon routes.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $routes = [
|
protected $routes = [
|
||||||
// Admin AdvsController
|
// Admin AdvsController
|
||||||
'admin/advs' => [
|
'admin/advs' => [
|
||||||
@ -244,59 +213,17 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon middleware.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $middleware = [
|
protected $middleware = [
|
||||||
SetLang::class,
|
SetLang::class,
|
||||||
redirectDiffrentLang::class,
|
redirectDiffrentLang::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Addon group middleware.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $groupMiddleware = [
|
|
||||||
//'web' => [
|
|
||||||
// Visiosoft\AdvsModule\Http\Middleware\ExampleMiddleware::class,
|
|
||||||
//],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Addon route middleware.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $routeMiddleware = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon event listeners.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
TableIsQuerying::class => [
|
TableIsQuerying::class => [
|
||||||
AddAdvsSettingsScript::class,
|
AddAdvsSettingsScript::class,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon alias bindings.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $aliases = [
|
|
||||||
//'Example' => Visiosoft\AdvsModule\Example::class
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon class bindings.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $bindings = [
|
protected $bindings = [
|
||||||
// AdvsCfValuesEntryModel::class => CfValueModel::class,
|
// AdvsCfValuesEntryModel::class => CfValueModel::class,
|
||||||
// AdvsCustomFieldAdvsEntryModel::class => CustomFieldAdvModel::class,
|
// AdvsCustomFieldAdvsEntryModel::class => CustomFieldAdvModel::class,
|
||||||
@ -327,50 +254,12 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
ProductoptionsValueRepositoryInterface::class => ProductoptionsValueRepository::class,
|
ProductoptionsValueRepositoryInterface::class => ProductoptionsValueRepository::class,
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* Additional service providers.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $providers = [
|
|
||||||
//\ExamplePackage\Provider\ExampleProvider::class
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon view overrides.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $overrides = [
|
protected $overrides = [
|
||||||
'streams::form/form' => 'visiosoft.module.advs::form/form',
|
'streams::form/form' => 'visiosoft.module.advs::form/form',
|
||||||
//'streams::errors/404' => 'module::errors/404',
|
//'streams::errors/404' => 'module::errors/404',
|
||||||
//'streams::errors/500' => 'module::errors/500',
|
//'streams::errors/500' => 'module::errors/500',
|
||||||
];
|
];
|
||||||
|
|
||||||
/**
|
|
||||||
* The addon mobile-only view overrides.
|
|
||||||
*
|
|
||||||
* @type array|null
|
|
||||||
*/
|
|
||||||
protected $mobile = [
|
|
||||||
//'streams::errors/404' => 'module::mobile/errors/404',
|
|
||||||
//'streams::errors/500' => 'module::mobile/errors/500',
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the addon.
|
|
||||||
*/
|
|
||||||
public function register()
|
|
||||||
{
|
|
||||||
// Run extra pre-boot registration logic here.
|
|
||||||
// Use method injection or commands to bring in services.
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Boot the addon.
|
|
||||||
* @param AddonCollection $addonCollection
|
|
||||||
* @param FileModel $fileModel
|
|
||||||
*/
|
|
||||||
public function boot(AddonCollection $addonCollection, FileModel $fileModel)
|
public function boot(AddonCollection $addonCollection, FileModel $fileModel)
|
||||||
{
|
{
|
||||||
// Run extra post-boot registration logic here.
|
// Run extra post-boot registration logic here.
|
||||||
@ -405,18 +294,4 @@ class AdvsModuleServiceProvider extends AddonServiceProvider
|
|||||||
// Disable file versioning
|
// Disable file versioning
|
||||||
$fileModel->disableVersioning();
|
$fileModel->disableVersioning();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Map additional addon routes.
|
|
||||||
*
|
|
||||||
* @param Router $router
|
|
||||||
*/
|
|
||||||
// public function map(Router $router)
|
|
||||||
// {
|
|
||||||
// // Register dynamic routes here for example.
|
|
||||||
// // Use method injection or commands to bring in services.
|
|
||||||
// }
|
|
||||||
public function map(Router $router)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
<?php namespace Visiosoft\AdvsModule\Http\Controller\Admin;
|
||||||
|
|
||||||
|
|
||||||
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
|
use Anomaly\SettingsModule\Setting\Contract\SettingRepositoryInterface;
|
||||||
use Anomaly\Streams\Platform\Application\Application;
|
use Anomaly\Streams\Platform\Application\Application;
|
||||||
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
use Anomaly\Streams\Platform\Entry\Contract\EntryInterface;
|
||||||
@ -10,7 +9,6 @@ use Anomaly\UsersModule\User\Contract\UserRepositoryInterface;
|
|||||||
use Anomaly\UsersModule\User\UserModel;
|
use Anomaly\UsersModule\User\UserModel;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
use Visiosoft\AdvsModule\Adv\Contract\AdvRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\Adv\Table\Filter\CategoryFilterQuery;
|
use Visiosoft\AdvsModule\Adv\Table\Filter\CategoryFilterQuery;
|
||||||
use Visiosoft\AdvsModule\Adv\Table\Filter\CityFilterQuery;
|
use Visiosoft\AdvsModule\Adv\Table\Filter\CityFilterQuery;
|
||||||
@ -18,7 +16,6 @@ use Visiosoft\AdvsModule\Adv\Table\Filter\StatusFilterQuery;
|
|||||||
use Visiosoft\AdvsModule\Adv\Table\Filter\UserFilterQuery;
|
use Visiosoft\AdvsModule\Adv\Table\Filter\UserFilterQuery;
|
||||||
use Visiosoft\AdvsModule\Adv\AdvModel;
|
use Visiosoft\AdvsModule\Adv\AdvModel;
|
||||||
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
use Visiosoft\AdvsModule\Adv\Event\ChangedStatusAd;
|
||||||
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
|
||||||
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
|
use Visiosoft\AdvsModule\Adv\Table\AdvTableBuilder;
|
||||||
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
use Anomaly\Streams\Platform\Http\Controller\AdminController;
|
||||||
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
||||||
@ -156,6 +153,7 @@ class AdvsController extends AdminController
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
'category' => [
|
'category' => [
|
||||||
|
'sort_column' => 'cat1',
|
||||||
'value' => function (EntryInterface $entry, CategoryModel $categoryModel) {
|
'value' => function (EntryInterface $entry, CategoryModel $categoryModel) {
|
||||||
$category = $categoryModel->getCat($entry->cat1);
|
$category = $categoryModel->getCat($entry->cat1);
|
||||||
if (!is_null($category))
|
if (!is_null($category))
|
||||||
|
|||||||
@ -20,7 +20,6 @@ use Visiosoft\AdvsModule\Adv\Event\viewAd;
|
|||||||
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
use Visiosoft\AdvsModule\Adv\Form\AdvFormBuilder;
|
||||||
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
use Visiosoft\AdvsModule\Option\Contract\OptionRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
use Visiosoft\AdvsModule\OptionConfiguration\Contract\OptionConfigurationRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\OptionConfiguration\OptionConfigurationModel;
|
|
||||||
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
use Visiosoft\AdvsModule\Productoption\Contract\ProductoptionRepositoryInterface;
|
||||||
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
use Visiosoft\AdvsModule\ProductoptionsValue\Contract\ProductoptionsValueRepositoryInterface;
|
||||||
use Visiosoft\AlgoliaModule\Search\SearchModel;
|
use Visiosoft\AlgoliaModule\Search\SearchModel;
|
||||||
|
|||||||
@ -5,6 +5,8 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
{% set enableCaptcha = setting_value('visiosoft.module.profile::google_captcha_site_key') and setting_value('visiosoft.module.profile::google_captcha_secret_key') %}
|
||||||
|
|
||||||
<div class="py-4">
|
<div class="py-4">
|
||||||
<div class="row justify-content-center bg-light rounded border px-3">
|
<div class="row justify-content-center bg-light rounded border px-3">
|
||||||
<div class="col-12 col-md-6 text-left p-3 m-0">
|
<div class="col-12 col-md-6 text-left p-3 m-0">
|
||||||
@ -20,6 +22,10 @@
|
|||||||
'url':form.options.url
|
'url':form.options.url
|
||||||
})|raw }}
|
})|raw }}
|
||||||
|
|
||||||
|
{% if enableCaptcha %}
|
||||||
|
<input type="hidden" name="recaptcha_token" id="recaptcha_token" class="recaptcha-token">
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% include 'visiosoft.theme.base::addons/anomaly/users-module/partials/register-form' %}
|
{% include 'visiosoft.theme.base::addons/anomaly/users-module/partials/register-form' %}
|
||||||
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
@ -49,7 +55,7 @@
|
|||||||
{{ form_close() }}
|
{{ form_close() }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ addBlock('register/corporate-register')|raw }}
|
{{ addBlock('register/corporate-register', {'enableCaptcha': enableCaptcha})|raw }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-12 col-md-6 py-3 pr-0 instructions d-none d-md-block">
|
<div class="col-12 col-md-6 py-3 pr-0 instructions d-none d-md-block">
|
||||||
@ -76,6 +82,14 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{% if enableCaptcha %}
|
||||||
|
{% set reCAPTCHASiteKey = setting_value('visiosoft.module.profile::google_captcha_site_key') %}
|
||||||
|
<script>
|
||||||
|
let reCAPTCHASiteKey = "{{ reCAPTCHASiteKey }}"
|
||||||
|
</script>
|
||||||
|
{{ asset_add('scripts.js', asset_download('https://www.google.com/recaptcha/api.js?render=' ~ reCAPTCHASiteKey, 60*60*24)) }}
|
||||||
|
{{ asset_add("scripts.js", "visiosoft.module.profile::assets/js/captcha.js") }}
|
||||||
|
{% endif %}
|
||||||
{{ asset_add("scripts.js", "visiosoft.theme.base::js/register.js") }}
|
{{ asset_add("scripts.js", "visiosoft.theme.base::js/register.js") }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"maatwebsite/excel": "*"
|
"maatwebsite/excel": "*",
|
||||||
|
"google/recaptcha": "1.2.*"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,6 @@
|
|||||||
|
grecaptcha.ready(function() {
|
||||||
|
grecaptcha.execute(reCAPTCHASiteKey)
|
||||||
|
.then(function(token) {
|
||||||
|
$('.recaptcha-token').val(token)
|
||||||
|
});
|
||||||
|
});
|
||||||
@ -4,13 +4,18 @@ return [
|
|||||||
'monitoring' => [
|
'monitoring' => [
|
||||||
'stacked' => false,
|
'stacked' => false,
|
||||||
'tabs' => [
|
'tabs' => [
|
||||||
|
|
||||||
'general_setting' => [
|
'general_setting' => [
|
||||||
'title' => 'visiosoft.module.profile::section.general_setting',
|
'title' => 'visiosoft.module.profile::section.general_setting',
|
||||||
'fields' => [
|
'fields' => [
|
||||||
'show_my_ads', 'upload_avatar', 'show_tax_office'
|
'show_my_ads', 'upload_avatar', 'show_tax_office'
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'recaptcha' => [
|
||||||
|
'title' => 'visiosoft.module.profile::section.recaptcha',
|
||||||
|
'fields' => [
|
||||||
|
'google_captcha_site_key', 'google_captcha_secret_key', 'score_threshold'
|
||||||
|
],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -13,11 +13,25 @@ return [
|
|||||||
'default_value' => 1
|
'default_value' => 1
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'show_tax_office' => [
|
'show_tax_office' => [
|
||||||
'type' => 'anomaly.field_type.boolean',
|
'type' => 'anomaly.field_type.boolean',
|
||||||
'config' => [
|
'config' => [
|
||||||
'default_value' => true,
|
'default_value' => true,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
'google_captcha_site_key' => [
|
||||||
|
'type' => 'anomaly.field_type.text',
|
||||||
|
],
|
||||||
|
'google_captcha_secret_key' => [
|
||||||
|
'type' => 'anomaly.field_type.text',
|
||||||
|
],
|
||||||
|
"score_threshold" => [
|
||||||
|
"type" => "anomaly.field_type.decimal",
|
||||||
|
"config" => [
|
||||||
|
"default_value" => 0.5,
|
||||||
|
"decimals" => 1,
|
||||||
|
"min" => 0.0,
|
||||||
|
"max" => 1.0,
|
||||||
|
]
|
||||||
|
],
|
||||||
];
|
];
|
||||||
@ -38,4 +38,8 @@ return [
|
|||||||
// Mail
|
// Mail
|
||||||
'update_email_mail_subject' => 'Email Updated!',
|
'update_email_mail_subject' => 'Email Updated!',
|
||||||
'update_email_mail_message' => 'Your Email Has Been Updated!',
|
'update_email_mail_message' => 'Your Email Has Been Updated!',
|
||||||
|
|
||||||
|
// Register
|
||||||
|
'recaptcha_field_is_required' => 'reCaptcha field is required.',
|
||||||
|
'failed_to_validate_captcha' => 'Failed to validate captcha.',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -8,4 +8,5 @@ return [
|
|||||||
'title' => 'Adress',
|
'title' => 'Adress',
|
||||||
],
|
],
|
||||||
'general_setting' => 'General Settings',
|
'general_setting' => 'General Settings',
|
||||||
|
'recaptcha' => 'reCAPTCHA',
|
||||||
];
|
];
|
||||||
|
|||||||
@ -7,8 +7,17 @@ return [
|
|||||||
'upload_avatar' => [
|
'upload_avatar' => [
|
||||||
'name' => 'Avatar Upload',
|
'name' => 'Avatar Upload',
|
||||||
],
|
],
|
||||||
|
|
||||||
'show_tax_office' => [
|
'show_tax_office' => [
|
||||||
'name' => 'Show Tax Office Field',
|
'name' => 'Show Tax Office Field',
|
||||||
],
|
],
|
||||||
|
'google_captcha_site_key' => [
|
||||||
|
'name' => 'Google Captcha Site Key',
|
||||||
|
],
|
||||||
|
'google_captcha_secret_key' => [
|
||||||
|
'name' => 'Google Captcha Secret Key',
|
||||||
|
],
|
||||||
|
'score_threshold' => [
|
||||||
|
'name' => 'Score Threshold',
|
||||||
|
'instructions' => 'A value between 0 and 1. The higher the threshold the more strict ReCaptcha is in trying to determine if a user is a bot or not.',
|
||||||
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -3,7 +3,6 @@
|
|||||||
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
use Anomaly\Streams\Platform\Ui\Form\FormBuilder;
|
||||||
use Visiosoft\ProfileModule\Profile\Register2\Command\SetOptions;
|
use Visiosoft\ProfileModule\Profile\Register2\Command\SetOptions;
|
||||||
use Anomaly\UsersModule\User\UserModel;
|
use Anomaly\UsersModule\User\UserModel;
|
||||||
use Visiosoft\ProfileModule\Profile\Validation\ValidateRegister;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class RegisterFormBuilder
|
* Class RegisterFormBuilder
|
||||||
@ -31,80 +30,6 @@ class Register2FormBuilder extends FormBuilder
|
|||||||
*/
|
*/
|
||||||
protected $model = UserModel::class;
|
protected $model = UserModel::class;
|
||||||
|
|
||||||
/**
|
|
||||||
* The form fields.
|
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
protected $fields = [
|
|
||||||
'username' => [
|
|
||||||
'required' => true,
|
|
||||||
],
|
|
||||||
'first_name' => [
|
|
||||||
'instructions' => false,
|
|
||||||
'required' => true,
|
|
||||||
],
|
|
||||||
'last_name' => [
|
|
||||||
'instructions' => false,
|
|
||||||
'required' => true,
|
|
||||||
],
|
|
||||||
'phone' => [
|
|
||||||
'type' => 'anomaly.field_type.text',
|
|
||||||
'required' => true,
|
|
||||||
'rules' => [
|
|
||||||
'valid_register',
|
|
||||||
],
|
|
||||||
'validators' => [
|
|
||||||
'valid_register' => [
|
|
||||||
'message' => false,
|
|
||||||
'handler' => ValidateRegister::class,
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
'email' => [
|
|
||||||
'instructions' => false,
|
|
||||||
],
|
|
||||||
'password' => [
|
|
||||||
'instructions' => false,
|
|
||||||
],
|
|
||||||
"accept_terms" => [
|
|
||||||
"type" => "anomaly.field_type.boolean",
|
|
||||||
"required" => true,
|
|
||||||
"config" => [
|
|
||||||
"default_value" => false,
|
|
||||||
"mode" => "checkbox",
|
|
||||||
"label" => 'visiosoft.module.profile::field.accept_terms_label',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"accept_protection_law" => [
|
|
||||||
"type" => "anomaly.field_type.boolean",
|
|
||||||
"required" => true,
|
|
||||||
"config" => [
|
|
||||||
"default_value" => false,
|
|
||||||
"mode" => "checkbox",
|
|
||||||
"label" => 'visiosoft.module.profile::field.accept_protection_law_label',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"accept_privacy_terms" => [
|
|
||||||
"type" => "anomaly.field_type.boolean",
|
|
||||||
"required" => true,
|
|
||||||
"config" => [
|
|
||||||
"default_value" => false,
|
|
||||||
"mode" => "checkbox",
|
|
||||||
"label" => 'visiosoft.module.profile::field.accept_privacy_terms_label',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"receive_sms_emails" => [
|
|
||||||
"type" => "anomaly.field_type.boolean",
|
|
||||||
"required" => true,
|
|
||||||
"config" => [
|
|
||||||
"default_value" => false,
|
|
||||||
"mode" => "checkbox",
|
|
||||||
"label" => 'visiosoft.module.profile::field.receive_sms_emails_label',
|
|
||||||
]
|
|
||||||
],
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The form actions.
|
* The form actions.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -0,0 +1,109 @@
|
|||||||
|
<?php namespace Visiosoft\ProfileModule\Profile\Register2;
|
||||||
|
|
||||||
|
use Visiosoft\ProfileModule\Profile\Validation\ValidateRegister;
|
||||||
|
use Visiosoft\ProfileModule\Rules\ReCaptchaRule;
|
||||||
|
|
||||||
|
class Register2FormFields
|
||||||
|
{
|
||||||
|
public function handle(Register2FormBuilder $builder)
|
||||||
|
{
|
||||||
|
$captchaSiteKey = setting_value('visiosoft.module.profile::google_captcha_site_key');
|
||||||
|
$captchaSecretKey = setting_value('visiosoft.module.profile::google_captcha_secret_key');
|
||||||
|
|
||||||
|
$register = [];
|
||||||
|
if ($captchaSiteKey && $captchaSecretKey) {
|
||||||
|
$register = [
|
||||||
|
'recaptcha_token' => [
|
||||||
|
'required' => true,
|
||||||
|
'type' => 'anomaly.field_type.text',
|
||||||
|
'config' => [
|
||||||
|
"max" => 0,
|
||||||
|
],
|
||||||
|
'rules' => [
|
||||||
|
'valid_recaptcha'
|
||||||
|
],
|
||||||
|
'validators' => [
|
||||||
|
'valid_recaptcha' => [
|
||||||
|
'message' => false,
|
||||||
|
'handler' => ReCaptchaRule::class
|
||||||
|
]
|
||||||
|
]
|
||||||
|
],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$builder->setFields(
|
||||||
|
array_merge(
|
||||||
|
$register,
|
||||||
|
[
|
||||||
|
'username' => [
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'first_name' => [
|
||||||
|
'instructions' => false,
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'last_name' => [
|
||||||
|
'instructions' => false,
|
||||||
|
'required' => true,
|
||||||
|
],
|
||||||
|
'phone' => [
|
||||||
|
'type' => 'anomaly.field_type.text',
|
||||||
|
'required' => true,
|
||||||
|
'rules' => [
|
||||||
|
'valid_register',
|
||||||
|
],
|
||||||
|
'validators' => [
|
||||||
|
'valid_register' => [
|
||||||
|
'message' => false,
|
||||||
|
'handler' => ValidateRegister::class,
|
||||||
|
],
|
||||||
|
],
|
||||||
|
],
|
||||||
|
'email' => [
|
||||||
|
'instructions' => false,
|
||||||
|
],
|
||||||
|
'password' => [
|
||||||
|
'instructions' => false,
|
||||||
|
],
|
||||||
|
"accept_terms" => [
|
||||||
|
"type" => "anomaly.field_type.boolean",
|
||||||
|
"required" => true,
|
||||||
|
"config" => [
|
||||||
|
"default_value" => false,
|
||||||
|
"mode" => "checkbox",
|
||||||
|
"label" => 'visiosoft.module.profile::field.accept_terms_label',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"accept_protection_law" => [
|
||||||
|
"type" => "anomaly.field_type.boolean",
|
||||||
|
"required" => true,
|
||||||
|
"config" => [
|
||||||
|
"default_value" => false,
|
||||||
|
"mode" => "checkbox",
|
||||||
|
"label" => 'visiosoft.module.profile::field.accept_protection_law_label',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"accept_privacy_terms" => [
|
||||||
|
"type" => "anomaly.field_type.boolean",
|
||||||
|
"required" => true,
|
||||||
|
"config" => [
|
||||||
|
"default_value" => false,
|
||||||
|
"mode" => "checkbox",
|
||||||
|
"label" => 'visiosoft.module.profile::field.accept_privacy_terms_label',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
"receive_sms_emails" => [
|
||||||
|
"type" => "anomaly.field_type.boolean",
|
||||||
|
"required" => true,
|
||||||
|
"config" => [
|
||||||
|
"default_value" => false,
|
||||||
|
"mode" => "checkbox",
|
||||||
|
"label" => 'visiosoft.module.profile::field.receive_sms_emails_label',
|
||||||
|
]
|
||||||
|
],
|
||||||
|
]
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -62,7 +62,8 @@ class Register2FormHandler
|
|||||||
$fields['accept_terms'],
|
$fields['accept_terms'],
|
||||||
$fields['accept_protection_law'],
|
$fields['accept_protection_law'],
|
||||||
$fields['accept_privacy_terms'],
|
$fields['accept_privacy_terms'],
|
||||||
$fields['receive_sms_emails']
|
$fields['receive_sms_emails'],
|
||||||
|
$fields['recaptcha_token']
|
||||||
);
|
);
|
||||||
|
|
||||||
$register = $users->create($fields);
|
$register = $users->create($fields);
|
||||||
|
|||||||
@ -0,0 +1,37 @@
|
|||||||
|
<?php namespace Visiosoft\ProfileModule\Rules;
|
||||||
|
|
||||||
|
use Anomaly\Streams\Platform\Message\MessageBag;
|
||||||
|
use ReCaptcha\ReCaptcha;
|
||||||
|
|
||||||
|
class ReCaptchaRule
|
||||||
|
{
|
||||||
|
private $message;
|
||||||
|
|
||||||
|
public function __construct(MessageBag $message)
|
||||||
|
{
|
||||||
|
$this->message = $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function handle($attribute, $value)
|
||||||
|
{
|
||||||
|
if (empty($value)) {
|
||||||
|
$this->message->error(trans('visiosoft.module.profile::message.recaptcha_field_is_required'));
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$recaptcha = new ReCaptcha(setting_value('visiosoft.module.profile::google_captcha_secret_key'));
|
||||||
|
|
||||||
|
$resp = $recaptcha->setExpectedHostname(request()->server('SERVER_NAME'))
|
||||||
|
->setScoreThreshold(setting_value('visiosoft.module.profile::score_threshold'))
|
||||||
|
->verify($value, request()->server('REMOTE_ADDR'));
|
||||||
|
|
||||||
|
if (!$resp->isSuccess()) {
|
||||||
|
$this->message->error('visiosoft.module.profile::message.failed_to_validate_captcha');
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user