nette/ sandbox
此包已被废弃且不再维护。作者建议使用nette/web-project包代替。
v1.0.1
2022-05-24 20:24 UTC
Requires
- php: >=7.4
- latte/latte: ^2.11 || ^3.0
- nette/application: ^3.1
- nette/bootstrap: ^3.1
- nette/database: ^3.1
- nette/di: ^3.0
- nette/forms: ^3.1
- nette/http: ^3.1
- nette/robot-loader: ^3.3
- nette/security: ^3.1
- nette/utils: ^3.2
- tracy/tracy: ^2.8
This package is auto-updated.
Last update: 2023-03-14 01:03:56 UTC
README
用户管理示例。
- 用户登录、注册和登出(
SignPresenter
) - 命令行注册(
bin/create-user.php
) - 使用数据库表进行认证(
UserFacade
) - 密码散列
- 使用
RequireLoggedUser
特质进行认证的DashboardPresenter
- 使用Bootstrap CSS框架渲染表单
- 用户登录时使用token进行自动CSRF保护(
FormFactory
) - 将表单工厂分离成独立类(
SignInFormFactory
、SignUpFormFactory
) - 登录后返回前页(
SignPresenter::$backlink
)
安装
git clone https://github.com/nette-examples/user-authentication
cd user-authentication
composer install
在config/local.neon
文件中设置数据库访问数据
database: dsn: 'mysql:host=127.0.0.1;dbname=***' user: *** password: ***
并通过导入users.mysql.sql
文件在数据库中创建一个用户表
开始的最简单方法是启动项目根目录内置的PHP服务器
php -S localhost:8000 www/index.php
然后在浏览器中访问http://localhost:8000
以查看欢迎页面。
需要PHP版本7.4或更高。