Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nette-examples/user-authentication
Example of user management in Nette
https://github.com/nette-examples/user-authentication
authentication nette nette-example php
Last synced: 26 days ago
JSON representation
Example of user management in Nette
- Host: GitHub
- URL: https://github.com/nette-examples/user-authentication
- Owner: nette-examples
- Created: 2021-10-09T09:48:24.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2024-04-26T10:49:51.000Z (6 months ago)
- Last Synced: 2024-04-26T11:48:24.373Z (6 months ago)
- Topics: authentication, nette, nette-example, php
- Language: PHP
- Homepage:
- Size: 61.5 KB
- Stars: 11
- Watchers: 8
- Forks: 17
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
User Authentication (Nette example)
===================================Example of user management.
- User login, registration and logout (`SignPresenter`)
- Command line registration (`bin/create-user.php`)
- Authentication using database table (`UserFacade`)
- Password hashing
- Presenter requiring authentication (`DashboardPresenter`) using the `RequireLoggedUser` trait
- Rendering forms using Bootstrap CSS framework
- Automatic CSRF protection using a token when the user is logged in (`FormFactory`)
- Separation of form factories into independent classes (`SignInFormFactory`, `SignUpFormFactory`)
- Return to previous page after login (`SignPresenter::$backlink`)Installation
------------```shell
git clone https://github.com/nette-examples/user-authentication
cd user-authentication
composer install
```Make directories `data/`, `temp/` and `log/` writable.
By default, SQLite is used as the database which is located in the `data/db.sqlite` file. If you would like to switch to a different database, configure access in the `config/local.neon` file:
```neon
database:
dsn: 'mysql:host=127.0.0.1;dbname=***'
user: ***
password: ***
```And then create the `users` table using SQL statements in the [data/mysql.sql](data/mysql.sql) file.
The simplest way to get started is to start the built-in PHP server in the root directory of your project:
```shell
php -S localhost:8000 www/index.php
```Then visit `http://localhost:8000` in your browser to see the welcome page.
It requires PHP version 8.1 or newer.