Download the PHP package drago-ex/project-auth without Composer
On this page you can find all versions of the php package drago-ex/project-auth. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download drago-ex/project-auth
More information about drago-ex/project-auth
Files in drago-ex/project-auth
Package project-auth
Short Description Authentication and user access package for the Drago project.
License MIT
Informations about the package project-auth
Drago Project Auth
Authentication and user access package for the Drago project. This package provides a complete authentication layer including user login, registration, password recovery and access control. It is designed as a modular extension for projects built on top of the Drago ecosystem and Nette Framework.
Requirements
- PHP >= 8.3, < 9
- Drago Project
Installation
npm Installation
The authentication UI requires the theme switcher and Font Awesome icons:
Files copied into the project
The files are copied into the project by drago-ex/project-tools,
as set in extra.drago-tools of this package's composer.json.
Database migration
The package has migration-priority 10, so the users table exists before the packages that use it.
Features
- User authentication (sign in / sign out)
- User registration (sign up)
- Password recovery and reset
- Email address verification (after registration and when the address changes)
- Rate limiting of sign-in, registration and password recovery
- User identity handling
- Integration with Nette Security and DI
- Ready-to-use authentication UI components
Configuration
Parameters in app/Presentation/Sign/conf.neon:
authMailFrom- sender of the account emails, use an address of your domainauthRequireEmailVerification- a new account confirms its email address by a link (defaulttrue)mailsection - SMTP connection
After signing in, the user goes to the administration (:Backend:Admin:), or to the front page (:Front:Home:)
when the ACL does not allow the administration to them. To change it, edit the SignedInDestination and
FallbackDestination constants in app/Presentation/Sign/SignPresenter.php.
Behind a reverse proxy, set http: proxy:, otherwise the per-IP limits apply to the proxy address.
Rate limiting
Attempts are counted in the application cache; clearing temp/cache resets them.
| Action | Limit |
|---|---|
| Sign-in | 10 failed attempts per email and 30 per IP address in 15 minutes |
| Registration | 10 attempts per IP address in an hour |
| Password recovery | 5 requests per email and 20 per IP address in an hour, 10 wrong codes in 15 minutes |
| New confirmation link | 3 requests per email and 10 per IP address in an hour |
Security
- Passwords are hashed by
Nette\Security\Passwords; rules inSign/PasswordPolicy(at least 12 characters). - Sign-in and password recovery do not reveal whether an email has an account.
- Changing or recovering the password signs the user out of all other sessions.
- Recovery codes and confirmation links are stored hashed, expire and work only once.
- With email verification on, registration answers the same for a registered address and only emails its owner; without verification it says that the address is already used (the new account would be usable at once).
- The link for a new confirmation email is shown only after the right password of an unconfirmed account.
- Two-factor authentication is not included.
Emails
The email templates are in Sign/Email/ (shared layout @email.latte, also used by Sign/Recovery/email.latte).
To catch emails locally, add Mailpit to docker-compose.override.yaml:
and point the mailer to it in Sign/conf.neon:
Emails are shown at http://localhost:8025.
Adds a new user to the database
Validates the email and the password (PasswordPolicy), hashes the password, generates a token, and ensures the email is unique.
Secure access to the section
A visitor who is not signed in goes to the sign-in page and, after signing in, back to the requested page.
Optional add-ons
The package works without them. Set them up by hand as described below when the project needs them.
Permissions
The package works without permissions and without drago-ex/permission.
For basic permissions, install drago-ex/permission and generate the access rules from bin/create-auth-permission:
Users have no roles of their own until getRolesByUser() in app/Model/User/UserRepository.php returns them.
To load them from the database of drago-ex/project-permission,
implement it:
All versions of project-auth with dependencies
drago-ex/database Version ^5.0
drago-ex/application Version ^4.0
drago-ex/form Version ^3.0
drago-ex/migration Version ^1.0
drago-ex/utils Version ^2.0
drago-ex/translator Version ^4.0.1
drago-ex/project-front Version ^3.0
drago-ex/project-backend Version ^1.0
nette/caching Version ^3.3
nette/http Version ^3.0
nette/mail Version ^4.0
nette/security Version ^3.2