Compare commits
5 Commits
0.7.1
...
20ed4860da
Author | SHA1 | Date | |
---|---|---|---|
20ed4860da
|
|||
e059f09e2f
|
|||
8794b8af4e
|
|||
85e181e51c
|
|||
01153867b3
|
76
.env.example
76
.env.example
@@ -1,68 +1,8 @@
|
|||||||
APP_NAME=Laravel
|
DOCKER_NGINX_PORT=8080
|
||||||
APP_ENV=local
|
DOCKER_DB_PORT=3306
|
||||||
APP_KEY=
|
MYSQL_ROOT_PASSWORD=root_pass
|
||||||
APP_DEBUG=true
|
DB_DATABASE=captcha
|
||||||
APP_URL=http://localhost
|
DB_USERNAME=captcha
|
||||||
|
DB_PASSWORD=captcha_pass
|
||||||
APP_FORCE_HTTPS=false
|
UID=1000
|
||||||
|
GID=1000
|
||||||
APP_DEMO_MODE=false
|
|
||||||
APP_DEMO_EMAIL=
|
|
||||||
APP_DEMO_PASSWORD=
|
|
||||||
|
|
||||||
APP_DEFAULT_USER_TIMEZONE=UTC
|
|
||||||
# Valid languages: ru | en
|
|
||||||
APP_DEFAULT_LOCALE=ru
|
|
||||||
|
|
||||||
LOG_CHANNEL=daily
|
|
||||||
LOG_DEPRECATIONS_CHANNEL=deprecations
|
|
||||||
LOG_LEVEL=debug
|
|
||||||
|
|
||||||
DB_CONNECTION=mysql
|
|
||||||
DB_HOST=127.0.0.1
|
|
||||||
DB_PORT=3306
|
|
||||||
DB_DATABASE=laravel
|
|
||||||
DB_USERNAME=root
|
|
||||||
DB_PASSWORD=
|
|
||||||
|
|
||||||
BROADCAST_DRIVER=log
|
|
||||||
CACHE_DRIVER=file
|
|
||||||
FILESYSTEM_DISK=local
|
|
||||||
QUEUE_CONNECTION=sync
|
|
||||||
SESSION_DRIVER=file
|
|
||||||
SESSION_LIFETIME=120
|
|
||||||
|
|
||||||
MEMCACHED_HOST=127.0.0.1
|
|
||||||
|
|
||||||
REDIS_HOST=127.0.0.1
|
|
||||||
REDIS_PASSWORD=null
|
|
||||||
REDIS_PORT=6379
|
|
||||||
|
|
||||||
MAIL_MAILER=smtp
|
|
||||||
MAIL_HOST=mailpit
|
|
||||||
MAIL_PORT=1025
|
|
||||||
MAIL_USERNAME=null
|
|
||||||
MAIL_PASSWORD=null
|
|
||||||
MAIL_ENCRYPTION=null
|
|
||||||
MAIL_FROM_ADDRESS="hello@example.com"
|
|
||||||
MAIL_FROM_NAME="${APP_NAME}"
|
|
||||||
|
|
||||||
AWS_ACCESS_KEY_ID=
|
|
||||||
AWS_SECRET_ACCESS_KEY=
|
|
||||||
AWS_DEFAULT_REGION=us-east-1
|
|
||||||
AWS_BUCKET=
|
|
||||||
AWS_USE_PATH_STYLE_ENDPOINT=false
|
|
||||||
|
|
||||||
PUSHER_APP_ID=
|
|
||||||
PUSHER_APP_KEY=
|
|
||||||
PUSHER_APP_SECRET=
|
|
||||||
PUSHER_HOST=
|
|
||||||
PUSHER_PORT=443
|
|
||||||
PUSHER_SCHEME=https
|
|
||||||
PUSHER_APP_CLUSTER=mt1
|
|
||||||
|
|
||||||
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
|
||||||
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
|
||||||
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
|
||||||
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
|
||||||
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
|
21
.gitignore
vendored
21
.gitignore
vendored
@@ -1,19 +1,6 @@
|
|||||||
/.phpunit.cache
|
|
||||||
/node_modules
|
|
||||||
/public/build
|
|
||||||
/public/hot
|
|
||||||
/public/storage
|
|
||||||
/storage/*.key
|
|
||||||
/vendor
|
|
||||||
.env
|
.env
|
||||||
.env.backup
|
|
||||||
.env.production
|
|
||||||
.phpunit.result.cache
|
|
||||||
Homestead.json
|
|
||||||
Homestead.yaml
|
Homestead.yaml
|
||||||
auth.json
|
Homestead.json
|
||||||
npm-debug.log
|
/.vagrant
|
||||||
yarn-error.log
|
.phpunit.result.cache
|
||||||
/.fleet
|
|
||||||
/.idea
|
|
||||||
/.vscode
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2023 Leonid Nikitin (kor-elf)
|
Copyright (c) 2023 - 2024 Leonid Nikitin (kor-elf)
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
@@ -2,9 +2,11 @@
|
|||||||
|
|
||||||
Захотелось написать свой независимый сервис защиты от роботов. Сервис каптча написан на фреймворке Laravel. Вдохновлялся, а так же брал картинки с проекта <a href="https://github.com/wenlng/go-captcha" target="_blank">Go Captcha</a>.
|
Захотелось написать свой независимый сервис защиты от роботов. Сервис каптча написан на фреймворке Laravel. Вдохновлялся, а так же брал картинки с проекта <a href="https://github.com/wenlng/go-captcha" target="_blank">Go Captcha</a>.
|
||||||
|
|
||||||
|
[Сайт проекта](https://service-captcha.projects.kor-elf.net/)
|
||||||
|
|
||||||
## Зависимости
|
## Зависимости
|
||||||
|
|
||||||
php 8.2 (модули: redis, gd)
|
php 8.3 (модули: redis, gd)
|
||||||
|
|
||||||
redis
|
redis
|
||||||
|
|
||||||
@@ -23,10 +25,10 @@ Email: demo@tut-site.net
|
|||||||
https://captcha-admin-demo.tut-site.net/api-docs/
|
https://captcha-admin-demo.tut-site.net/api-docs/
|
||||||
|
|
||||||
## Javascript клиент для сайта
|
## Javascript клиент для сайта
|
||||||
https://git.kor-elf.net/kor-elf/captcha-rule-for-laravel
|
https://git.kor-elf.net/kor-elf/service-captcha-gui
|
||||||
|
|
||||||
## Как проверять со стороны бэкенда
|
## Как проверять со стороны бэкенда
|
||||||
Для Laravel 10 есть готовый пакет: https://git.kor-elf.net/kor-elf/captcha-rule-for-laravel
|
Для Laravel 10, 11 есть готовый пакет: https://git.kor-elf.net/kor-elf/captcha-rule-for-laravel
|
||||||
|
|
||||||
Можно установить этот пакет так: composer require kor-elf/captcha-rule-for-laravel
|
Можно установить этот пакет так: composer require kor-elf/captcha-rule-for-laravel
|
||||||
|
|
||||||
|
74
app/application/.env.example
Normal file
74
app/application/.env.example
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
APP_NAME=Laravel
|
||||||
|
APP_ENV=local
|
||||||
|
APP_KEY=
|
||||||
|
APP_DEBUG=true
|
||||||
|
APP_URL=http://localhost
|
||||||
|
|
||||||
|
APP_FORCE_HTTPS=false
|
||||||
|
|
||||||
|
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
|
||||||
|
CAPTCHA_PUBLIC_TOKEN=
|
||||||
|
|
||||||
|
APP_DEMO_MODE=false
|
||||||
|
APP_DEMO_EMAIL=
|
||||||
|
APP_DEMO_PASSWORD=
|
||||||
|
|
||||||
|
APP_DEFAULT_USER_TIMEZONE=UTC
|
||||||
|
# Valid languages: ru | en
|
||||||
|
APP_DEFAULT_LOCALE=ru
|
||||||
|
|
||||||
|
LOG_CHANNEL=daily
|
||||||
|
LOG_DEPRECATIONS_CHANNEL=deprecations
|
||||||
|
LOG_LEVEL=debug
|
||||||
|
|
||||||
|
DB_CONNECTION=mysql
|
||||||
|
DB_HOST=db
|
||||||
|
DB_PORT=3306
|
||||||
|
DB_DATABASE=captcha
|
||||||
|
DB_USERNAME=captcha
|
||||||
|
DB_PASSWORD=captcha_pass
|
||||||
|
|
||||||
|
BROADCAST_DRIVER=log
|
||||||
|
CACHE_DRIVER=redis
|
||||||
|
FILESYSTEM_DISK=local
|
||||||
|
QUEUE_CONNECTION=redis
|
||||||
|
SESSION_DRIVER=redis
|
||||||
|
SESSION_LIFETIME=120
|
||||||
|
|
||||||
|
MEMCACHED_HOST=127.0.0.1
|
||||||
|
|
||||||
|
REDIS_HOST=redis
|
||||||
|
REDIS_PASSWORD=null
|
||||||
|
REDIS_PORT=6379
|
||||||
|
|
||||||
|
MAIL_MAILER=smtp
|
||||||
|
MAIL_HOST=mailpit
|
||||||
|
MAIL_PORT=1025
|
||||||
|
MAIL_USERNAME=null
|
||||||
|
MAIL_PASSWORD=null
|
||||||
|
MAIL_ENCRYPTION=null
|
||||||
|
MAIL_FROM_ADDRESS="hello@example.com"
|
||||||
|
MAIL_FROM_NAME="${APP_NAME}"
|
||||||
|
|
||||||
|
AWS_ACCESS_KEY_ID=
|
||||||
|
AWS_SECRET_ACCESS_KEY=
|
||||||
|
AWS_DEFAULT_REGION=us-east-1
|
||||||
|
AWS_BUCKET=
|
||||||
|
AWS_USE_PATH_STYLE_ENDPOINT=false
|
||||||
|
|
||||||
|
PUSHER_APP_ID=
|
||||||
|
PUSHER_APP_KEY=
|
||||||
|
PUSHER_APP_SECRET=
|
||||||
|
PUSHER_HOST=
|
||||||
|
PUSHER_PORT=443
|
||||||
|
PUSHER_SCHEME=https
|
||||||
|
PUSHER_APP_CLUSTER=mt1
|
||||||
|
|
||||||
|
VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}"
|
||||||
|
VITE_PUSHER_HOST="${PUSHER_HOST}"
|
||||||
|
VITE_PUSHER_PORT="${PUSHER_PORT}"
|
||||||
|
VITE_PUSHER_SCHEME="${PUSHER_SCHEME}"
|
||||||
|
VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}"
|
19
app/application/.gitignore
vendored
Normal file
19
app/application/.gitignore
vendored
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
/.phpunit.cache
|
||||||
|
/node_modules
|
||||||
|
/public/build
|
||||||
|
/public/hot
|
||||||
|
/public/storage
|
||||||
|
/storage/*.key
|
||||||
|
/vendor
|
||||||
|
.env
|
||||||
|
.env.backup
|
||||||
|
.env.production
|
||||||
|
.phpunit.result.cache
|
||||||
|
Homestead.json
|
||||||
|
Homestead.yaml
|
||||||
|
auth.json
|
||||||
|
npm-debug.log
|
||||||
|
yarn-error.log
|
||||||
|
/.fleet
|
||||||
|
/.idea
|
||||||
|
/.vscode
|
@@ -19,7 +19,9 @@ final class AuthController extends Controller
|
|||||||
|
|
||||||
public function login(): View
|
public function login(): View
|
||||||
{
|
{
|
||||||
return view('public/login');
|
return view('public/login', [
|
||||||
|
'captcha' => config('app.captcha', false)
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function authorization(AuthorizationRequest $request): RedirectResponse
|
public function authorization(AuthorizationRequest $request): RedirectResponse
|
@@ -13,11 +13,17 @@ final class AuthorizationRequest extends FormRequest implements FormRequestDto
|
|||||||
*/
|
*/
|
||||||
public function rules(): array
|
public function rules(): array
|
||||||
{
|
{
|
||||||
return [
|
$rules = [
|
||||||
'email' => ['required', 'email', 'max:255'],
|
'email' => ['required', 'email', 'max:255'],
|
||||||
'password' => ['required', 'min:3'],
|
'password' => ['required', 'min:3'],
|
||||||
'remember' => ['nullable', 'boolean'],
|
'remember' => ['nullable', 'boolean'],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (config('app.captcha', false)) {
|
||||||
|
$rules['captcha-verified'] = ['captcha'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDto(): Authorization
|
public function getDto(): Authorization
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user