Версия 0.3.0 #3

Merged
kor-elf merged 11 commits from develop into main 2024-07-27 02:09:14 +05:00
7 changed files with 40 additions and 14 deletions
Showing only changes of commit 8bc4c0d8d0 - Show all commits

View File

@ -5,6 +5,7 @@ APP_DEBUG=true
APP_TIMEZONE=UTC
APP_URL=http://localhost
APP_CAPTCHA=false
CAPTCHA_API_DOMAIN=http://your-domain-captcha-or-IP:8081
CAPTCHA_PRIVATE_TOKEN=
CAPTCHA_STATIC_PATH=http://your-domain-captcha-or-IP:8081/captcha

View File

@ -19,7 +19,9 @@ public function __construct(
public function login(): View
{
return view('login');
return view('login', [
'captcha' => config('app.captcha', false),
]);
}
public function authorization(AuthorizationRequest $request): RedirectResponse

View File

@ -13,12 +13,17 @@ final class AuthorizationRequest extends FormRequest implements FormRequestDto
*/
public function rules(): array
{
return [
$rules = [
'email' => ['required', 'email', 'max:255'],
'password' => ['required', 'min:3'],
'captcha-verified' => ['captcha'],
'remember' => ['nullable', 'boolean'],
];
if (config('app.captcha', false)) {
$rules['captcha-verified'] = ['captcha'];
}
return $rules;
}
public function getDto(): Authorization

View File

@ -32,12 +32,17 @@ public function attributes(): array
*/
public function rules(): array
{
return [
$rules = [
'name' => ['nullable', 'string', 'max:255'],
'email' => ['nullable', 'string', 'max:255', 'email'],
'message' => ['required', 'string', 'max:5000'],
'captcha-verified' => ['captcha'],
];
if (config('app.captcha', false)) {
$rules['captcha-verified'] = ['captcha'];
}
return $rules;
}
public function getDto(): Send

View File

@ -28,6 +28,15 @@
'env' => env('APP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Сaptcha
|--------------------------------------------------------------------------
|
| Enables or disables captcha.
*/
'captcha' => (bool) env('APP_CAPTCHA', false),
/*
|--------------------------------------------------------------------------
| Application Debug Mode

View File

@ -49,9 +49,11 @@
</label>
</div>
</div>
@if($captcha)
<div class="form-group mb-4">
@captcha
</div>
@endif
</div>
<div class="d-grid">
<button type="submit" class="btn btn-gray-800">{{ __('Sign in') }}</button>

View File

@ -8,12 +8,14 @@
<x-site.forms.input :title="$websiteTranslations->translate('site.attributes.name')" :websiteTranslations="$websiteTranslations" name="name" type="text" value="" autofocus />
<x-site.forms.input :title="$websiteTranslations->translate('site.attributes.email')" :websiteTranslations="$websiteTranslations" name="email" type="text" value="" />
<x-site.forms.textarea-wysiwyg :title="$websiteTranslations->translate('site.attributes.message')" :websiteTranslations="$websiteTranslations" required name="message" value="" />
@if($captcha)
<div class="form-block">
@captcha
@error('captcha-verified')
<span class="invalid-feedback">{{ $message }}</span>
@enderror
</div>
@endif
<div class="form-block">
<button class="button" type="submit">{{ $websiteTranslations->translate('site.Feedback-send') }}</button>
</div>