7 Commits

Author SHA1 Message Date
20ed4860da Added the ability to enable captcha when logging in. 2024-04-25 23:45:07 +05:00
e059f09e2f Updated Laravel to 11. 2024-04-25 20:58:52 +05:00
8794b8af4e I returned the LICENSE.md file back. 2024-04-25 20:07:13 +05:00
85e181e51c Changed the project structure. 2024-04-25 19:56:34 +05:00
01153867b3 Update README.md.
Fixed link to JavaScript GUI repository.
2023-12-13 23:27:45 +06:00
172a9460df Fix https on prod.
Added the force_https parameter to env APP_FORCE_HTTPS. This will force https to be enabled.
2023-12-09 00:55:56 +06:00
a5ba9eb3f8 I added (int) to the configuration in the parameters, where we get the numbers through the env function. 2023-12-09 00:54:12 +06:00
394 changed files with 1961 additions and 1465 deletions

View File

@@ -1,66 +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_DEMO_MODE=false UID=1000
APP_DEMO_EMAIL= GID=1000
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
View File

@@ -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

View File

@@ -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:

View File

@@ -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

View 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
View 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

View File

@@ -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

View File

@@ -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