geniv/nette-identity-registration
Composer 安装命令:
composer require geniv/nette-identity-registration
包简介
Identity registration extension for Nette Framework
README 文档
README
Installation
$ composer require geniv/nette-identity-registration
or
"geniv/nette-identity-registration": ">=1.0.0"
require:
"php": ">=7.0.0", "nette/nette": ">=2.4.0", "geniv/nette-general-form": ">=1.0.0"
Include in application
CleanUserEvent & ApproveLinkEvent validate parameter format: http://php.net/manual/en/function.strtotime.php
ApproveLinkEvent destination parameter is string for $presenter->link()
neon configure:
# identity registration identityRegistration: # autowired: true # formContainer: Identity\Registration\FormContainer events: - Identity\Events\CleanUserEvent(-14 days) # clean non active user - CallbackEvent # check duplicity - SetValueEvent([active: false, role: guest]) # default value for registration - Identity\Events\RegistrationEvent # core registration - Identity\Events\ApproveLinkEvent(+1 hour, //link) # generate approve link admin: Identity\Events\EmailNotifyEvent # email for admin user: Identity\Events\EmailNotifyEvent # email for user
neon configure extension:
extensions: identityRegistration: Identity\Registration\Bridges\Nette\Extension
presenter usage:
protected function createComponentIdentityRegistration(RegistrationForm $registrationForm): RegistrationForm { //$registrationForm->setTemplatePath(__DIR__ . '/templates/RegistrationForm.latte'); $registrationForm->onSuccess[] = function (array $values) { $this->flashMessage('Registration!', 'info'); $this->redirect('this'); }; $registrationForm->onException[] = function (RegistrationException $e) { $this->flashMessage('Registration exception! ' . $e->getMessage(), 'danger'); $this->redirect('this'); }; return $registrationForm; }
approve usage:
public function actionApprove($h) { try { if ($this->identityModel->processApprove($h)) { $this->flashMessage('Approve!', 'info'); } } catch (IdentityException $e) { $this->flashMessage('Approve exception! ' . $e->getMessage(), 'danger'); } $this->redirect('default'); }
latte usage:
{control identityRegistration}
统计信息
- 总下载量: 23
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-17