2017 © Pedro Peláez
 

project passwordrecovery

Password recovery Nette extension.

image

sandbox/passwordrecovery

Password recovery Nette extension.

  • Tuesday, October 18, 2016
  • by ViPEr*CZ*
  • Repository
  • 1 Watchers
  • 0 Stars
  • 59 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 2 % Grown

The README.md

#Password recovery extension for Nette Framework

Requirements

Sandbox/PasswordRecovery requires PHP 8.1.0 or higher., (*1)

  • "nette/application": "^3.1",
  • "nette/bootstrap": "^3.2",
  • "nette/di": "^3.1",
  • "nette/forms": "^3.1",
  • "nette/mail": "^4.0",
  • "nette/robot-loader": "^4.0",
  • "nette/utils": "^4.0",
  • "latte/latte": "^3.0"

Installation

The best way to install Sandbox/PasswordRecovery is using Composer:, (*2)

$ composer require sandbox/passwordrecovery

Configuration

Then you have to register extension in config.neon., (*3)

extensions:
    passwordRecovery: Sandbox\PasswordRecovery\DI\PasswordRecoveryExtension

and configuration section in config.neon:, (*4)

passwordRecovery:
    passwordRecovery:
    sender: "sandbox@domain.net"
    subject: "Obnova hesla"
    submitButton: "Obnovit heslo"
    validatorMessage: "Prosím vložte validní heslo."
    equalPasswordMessage: "Hesla se musí shodovat."
    emptyPasswordMessage: "Heslo musí obsahovat alespoň %d znaků"
    minimalPasswordLength: 6
    expirationTime: 45 #minute, max 59
    errorMessage: "Odkaz pro obnovu hesla se nepodařilo odeslat. Zkuste to prosím znovu."
    mailer: @mail.mailer
    token: @Sandbox\PasswordRecovery\TokenManagerInterface

Next, you need to register a service that implements an interface UserRepositoryInterface and TokenManagerInterface. Example is sandbox project: https://github.com/ViPErCZ/sandbox, (*5)

Usage

Sample using in Presenter:, (*6)

/**
 * @return \Nette\Application\UI\Form
*/
protected function createComponentRecovery() {
    $control = $this->passwordRecovery->createDialog();
    $control->getResetForm()->onSuccess[] = function(Form $form) {
        $this->flashMessage('Odkaz pro obnovu hesla byl odeslán na Váš email ' . $form->getValues()['email'] . ".");
        $this->redrawControl('recoveryForm');
    };

    $control->getResetForm()->onError[] = function() {
        $this->redrawControl('recoveryForm');
    };

    $control->getNewPasswordForm()->onSuccess[] = function() {
        $this->flashMessage('Heslo bylo úspěšně nastaveno. Pokračujte na přihlašovací obrazovku.');
        if ($this->isAjax()) {
           $this->redrawControl('recoveryForm');
        } else {
           $this->redirect('Home:default');
        }
    };

    $control->getNewPasswordForm()->onError[] = function() {
        if ($this->isAjax()) {
           $this->redrawControl('recoveryForm');
        } else {
           $this->redirect('Home:default');
        }
    };

    return $control;
}

and template has default template (using twitter bootstrap class), (*7)

{snippet recoveryForm}


{$flash->message}
{if count($flashes) == 0} {control recovery} {/if} {/snippet}

If you want to use your custom template, set the variable templatePath to the path to the latte template., (*8)

Extension using Nette\Localization\Translator and all configurated strings are translated., (*9)


Homepage https://packagist.org/packages/vipercz/sandbox and repository https://github.com/ViPErCZ/passwordRecovery., (*10)

The Versions

18/10 2016

dev-master

9999999-dev http://vipersoftware.net

Password recovery Nette extension.

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

18/10 2016

v1.2.0

1.2.0.0 http://vipersoftware.net

Password recovery Nette extension.

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

24/02 2016

v1.1.0

1.1.0.0 http://vipersoftware.net

Password recovery Nette extension.

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

23/01 2016

v1.0.3

1.0.3.0 http://vipersoftware.net

Password recovery Nette extension.

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

22/01 2016

v1.0.2

1.0.2.0 http://vipersoftware.net

Password recovery Nette extension.

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

22/01 2016

v1.0.1

1.0.1.0 http://vipersoftware.net

Password recovery Nette extension.

  Sources   Download

MIT

The Requires

  • php >= 5.4.0

 

22/01 2016

v1.0.0

1.0.0.0 http://vipersoftware.net

Password recovery Nette extension.

  Sources   Download

MIT

The Requires

  • php >= 5.4.0