geniv/nette-identity-forgotten

Identity forgotten extension for Nette Framework

v1.0.0 2018-04-17 07:33 UTC

This package is auto-updated.

Last update: 2020-10-13 19:36:25 UTC


README

Installation

$ composer require geniv/nette-identity-forgotten

or

"geniv/nette-identity-forgotten": ">=1.0.0"

require:

"php": ">=7.0.0",
"nette/nette": ">=2.4.0",
"geniv/nette-general-form": ">=1.0.0"

Include in application

neon configure:

# identity forgotten
identityForgotten:
#   autowired: true
#   formContainerStep1: Identity\Registration\FormContainerStep1
#   formContainerStep2: Identity\Registration\FormContainerStep2
    eventsStep1:
        - Identity\Events\ForgottenStep1Event(+1 hour, //Forgotten:reset)       # generate forgotten link
        - Identity\Events\ForgottenEmailNotifyEvent                             # email for user
    eventsStep2:
        - Identity\Events\ForgottenStep2Event

neon configure extension:

extensions:
    identityForgotten: Identity\Forgotten\Bridges\Nette\Extension

presenter usage:

protected function createComponentIdentityForgottenStep1(ForgottenFormStep1 $forgottenFormStep1, ForgottenEmailNotifyEvent $emailNotifyEvent): ForgottenFormStep1
{
    $forgottenFormStep1->onSuccess[] = function (array $values) {
        $this->flashMessage('Step1!', 'info');
        $this->redirect('this');
    };
    $forgottenFormStep1->onException[] = function (EventException $e) {
        $this->flashMessage('Step1 exception! ' . $e->getMessage(), 'danger');
        $this->redirect('this');
    };
    return $forgottenFormStep1;
}

protected function createComponentIdentityForgottenStep2(ForgottenFormStep2 $forgottenFormStep2): ForgottenFormStep2
{
    $forgottenFormStep2->onSuccess[] = function (array $values) {
        $this->flashMessage('Step2!', 'info');
        $this->redirect('Login:');
    };
    $forgottenFormStep2->onException[] = function (EventException $e) {
        $this->flashMessage('Step2 exception! ' . $e->getMessage(), 'danger');
        $this->redirect('this');
    };
    return $forgottenFormStep2;
}

latte usage:

{control identityForgottenStep1}

{control identityForgottenStep2}