Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
96a10f5
Add option from config to clean expired passwords
APaikens Sep 4, 2015
add865e
Allow zfcuser 3.0
APaikens Nov 27, 2017
dddc1a9
Bump goalio mailservice version
APaikens Nov 27, 2017
60ba213
Make controller via factory
APaikens Feb 6, 2018
0b73da9
Drop serviceManager dependency
APaikens Feb 6, 2018
b078579
Adjust to ZF3
APaikens Feb 6, 2018
9c96f27
Update to ZF3
APaikens Feb 6, 2018
b0b10bd
Update to ZF3
APaikens Feb 6, 2018
383e2e6
Move password service to factories
APaikens Feb 6, 2018
83f94fe
Update to ZF3
APaikens Feb 6, 2018
90216e1
Drop service manager dependency
APaikens Feb 6, 2018
9b67ca4
Add missing factory
APaikens Feb 6, 2018
d02eba4
Add factory needed for ZF3
APaikens Feb 6, 2018
9163142
Remove unneded event
APaikens May 8, 2018
956d9bd
Remove unneded event initialisation
APaikens May 8, 2018
5a0c328
Remove unneded event initialisation
APaikens May 8, 2018
88ae478
Adjust factory to work with new ZF3
APaikens May 8, 2018
9547cb4
Migrated to Laminas using laminas-migration
Apr 3, 2020
6e4c5cb
Update composer.json
APaikens Apr 6, 2020
cf71464
Merge pull request #1 from TArbidans/I-laminas-migration
APaikens Apr 6, 2020
f38a324
Remove zfcBase and events
Apr 7, 2020
b359429
add db mapper
Apr 7, 2020
ea513ba
Merge pull request #2 from APaikens/I-laminas
APaikens Apr 7, 2020
66ffc35
Update composer.json
APaikens Jan 7, 2021
55a6635
phpStan scan fixes
RPencis Sep 1, 2021
496ad52
Merge pull request #3 from RPencis/I-phpStanFixes
APaikens Sep 8, 2021
450083e
Update mapper to work with latest hydrator
APaikens Mar 4, 2022
624b4fd
Set name as mandatory element for form creation
APaikens Sep 13, 2022
06bc6a2
Set name as mandatory element for reset form creation
APaikens Sep 13, 2022
4ac4699
Update ResetFilter.php
martinsDzirnieks Nov 29, 2022
00bd492
Update ResetFactory.php
martinsDzirnieks Nov 29, 2022
49016b4
Merge pull request #4 from martinsDzirnieks/master
APaikens Dec 28, 2022
607a4a0
add a trigger on password reset
ogranapskis Apr 26, 2023
4227390
Merge pull request #5 from ogranapskis/I-41135v2
APaikens Apr 26, 2023
e89a06a
Switch to divi-mail mailservice
APaikens Jun 25, 2025
dba6535
Update composer.json - fix typo
APaikens Jun 26, 2025
6e991a6
ResetFactory, Add user form filter settings from db, if there is set …
APaikens Dec 22, 2025
736d586
Update ResetFactory.php, typo fix
APaikens Dec 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ can be a little slow because we are a small company with only two developers. I
Requirements
------------

* [Zend Framework 2](https://github.com/zendframework/zf2) (latest master).
* [ZfcBase](https://github.com/ZF-Commons/ZfcBase) (latest master).
* [Laminas]() (latest master).
* [ZfcUser](https://github.com/ZF-Commons/ZfcUser) (latest master).
* [GoalioMailService](https://github.com/goalio/GoalioMailService) (latest master).

Expand Down Expand Up @@ -58,7 +57,6 @@ Installation
return array(
'modules' => array(
// ...
'ZfcBase',
'ZfcUser',
'GoalioMailService',
'GoalioForgotPassword'
Expand All @@ -71,9 +69,9 @@ Installation

3. Make sure that the MailService is configured correctly.

### Post-Install: Zend\Db
### Post-Install: Laminas\Db

1. If you do not already have a valid Zend\Db\Adapter\Adapter in your service
1. If you do not already have a valid Laminas\Db\Adapter\Adapter in your service
manager configuration, put the following in `./config/autoload/database.local.php`:

<?php
Expand All @@ -88,8 +86,8 @@ Installation
return array(
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter' => function ($sm) use ($dbParams) {
return new Zend\Db\Adapter\Adapter(array(
'Laminas\Db\Adapter\Adapter' => function ($sm) use ($dbParams) {
return new Laminas\Db\Adapter\Adapter(array(
'driver' => 'pdo',
'dsn' => 'mysql:dbname='.$dbParams['database'].';host='.$dbParams['hostname'],
'database' => $dbParams['database'],
Expand Down Expand Up @@ -126,7 +124,7 @@ The following options are available:
- **reset_expire** - Integer value in seconds when the login cookie should expire.
Default is `86400` (24 hours).
- **email_transport** - String value which transport class to use.
Default is `Zend\Mail\Transport\Sendmail`.
Default is `Laminas\Mail\Transport\Sendmail`.
- **reset_email_subject_line** - String value which transport class to use.
Default is `You requested to reset your password`.
- **email_from_address** - Array
Expand Down
13 changes: 11 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@
"zfcuser"
],
"homepage": "https://github.com/goalio/GoalioForgotPassword",
"repositories": [
{
"type": "vcs",
"url": "git@gitlab.di.lv:DIVI/divi-mail.git",
"trunk-path": "trunk",
"branches-path": "branches",
"tags-path": "tags"
}
],
"authors": [
{
"name": "Philipp Dobrigkeit",
Expand All @@ -16,8 +25,8 @@
}
],
"require": {
"goalio/goalio-mailservice": "1.*",
"zf-commons/zfc-user": "1.*"
"divi/divi-mail": "^1.0",
"zf-commons/zfc-user": "4.*"
},
"autoload": {
"psr-0": {
Expand Down
4 changes: 2 additions & 2 deletions config/goalioforgotpassword.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ $settings = array(
/**
* Mail Transport to use
*
* Default: 'Zend\Mail\Transport\Sendmail'
* Default: 'Laminas\Mail\Transport\Sendmail'
*/
//'email_transport' => 'Zend\Mail\Transport\Sendmail',
//'email_transport' => 'Laminas\Mail\Transport\Sendmail',

/**
* Password Model Entity Class
Expand Down
4 changes: 2 additions & 2 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
),
),
'controllers' => array(
'invokables' => array(
'goalioforgotpassword_forgot' => 'GoalioForgotPassword\Controller\ForgotController',
'factories' => array(
'goalioforgotpassword_forgot' => 'GoalioForgotPassword\Factory\Controller\ForgotControllerFactory',
),
),

Expand Down
37 changes: 14 additions & 23 deletions src/GoalioForgotPassword/Controller/ForgotController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace GoalioForgotPassword\Controller;

use Zend\Form\Form;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\Stdlib\ResponseInterface as Response;
use Zend\Stdlib\Parameters;
use Zend\View\Model\ViewModel;
use Laminas\Form\Form;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\Stdlib\ResponseInterface as Response;
use Laminas\Stdlib\Parameters;
use Laminas\View\Model\ViewModel;
use GoalioForgotPassword\Service\Password as PasswordService;
use GoalioForgotPassword\Options\ForgotControllerOptionsInterface;

Expand Down Expand Up @@ -54,6 +54,15 @@ class ForgotController extends AbstractActionController
*/
protected $zfcUserOptions;

public function __construct($passwordService, $forgotForm, $resetForm, $userService, $options, $zfcUserOptions) {
$this->passwordService = $passwordService;
$this->forgotForm = $forgotForm;
$this->resetForm = $resetForm;
$this->userService = $userService;
$this->options = $options;
$this->zfcUserOptions = $zfcUserOptions;
}

/**
* User page
*/
Expand Down Expand Up @@ -160,9 +169,6 @@ public function resetAction()

public function getUserService()
{
if (!$this->userService) {
$this->userService = $this->getServiceLocator()->get('zfcuser_user_service');
}
return $this->userService;
}

Expand All @@ -174,9 +180,6 @@ public function setUserService(UserService $userService)

public function getPasswordService()
{
if (!$this->passwordService) {
$this->passwordService = $this->getServiceLocator()->get('goalioforgotpassword_password_service');
}
return $this->passwordService;
}

Expand All @@ -188,9 +191,6 @@ public function setPasswordService(PasswordService $passwordService)

public function getForgotForm()
{
if (!$this->forgotForm) {
$this->setForgotForm($this->getServiceLocator()->get('goalioforgotpassword_forgot_form'));
}
return $this->forgotForm;
}

Expand All @@ -201,9 +201,6 @@ public function setForgotForm(Form $forgotForm)

public function getResetForm()
{
if (!$this->resetForm) {
$this->setResetForm($this->getServiceLocator()->get('goalioforgotpassword_reset_form'));
}
return $this->resetForm;
}

Expand Down Expand Up @@ -231,17 +228,11 @@ public function setOptions(ForgotControllerOptionsInterface $options)
*/
public function getOptions()
{
if (!$this->options instanceof ForgotControllerOptionsInterface) {
$this->setOptions($this->getServiceLocator()->get('goalioforgotpassword_module_options'));
}
return $this->options;
}

public function getZfcUserOptions()
{
if (!$this->zfcUserOptions instanceof PasswordOptionsInterface) {
$this->zfcUserOptions = $this->getServiceLocator()->get('zfcuser_module_options');
}
return $this->zfcUserOptions;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?php

namespace GoalioForgotPassword\Factory\Controller;

use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use \Interop\Container\ContainerInterface;
use GoalioForgotPassword\Controller\ForgotController;

/**
* Description of UserControllerFactory
*
* @author prautmanis
*/
class ForgotControllerFactory implements FactoryInterface{

public function __invoke(ContainerInterface $container, $requestedName, array $options = null) {

$controller = new ForgotController(
$container->get('goalioforgotpassword_password_service'),
$container->get('goalioforgotpassword_forgot_form'),
$container->get('goalioforgotpassword_reset_form'),
$container->get('zfcuser_user_service'),
$container->get('goalioforgotpassword_module_options'),
$container->get('zfcuser_module_options')
);

return $controller;
}

public function createService(ServiceLocatorInterface $serviceLocator) {
return $this->__invoke($serviceLocator,null);
}
}
32 changes: 32 additions & 0 deletions src/GoalioForgotPassword/Factory/Service/PasswordFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

namespace GoalioForgotPassword\Factory\Service;

use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
use Interop\Container\ContainerInterface;
use GoalioForgotPassword\Service\Password;

/**
* Description of UserControllerFactory
*
* @author prautmanis
*/
class PasswordFactory implements FactoryInterface{

public function __invoke(ContainerInterface $container, $requestedName, array $options = NULL) {
$controller = new Password(
$container->get('goalioforgotpassword_module_options'),
$container->get('goalioforgotpassword_password_mapper'),
$container->get('zfcuser_user_mapper'),
$container->get('goaliomailservice_message'),
$container->get('zfcuser_module_options')
);

return $controller;
}

public function createService(ServiceLocatorInterface $serviceLocator) {
return $this->__invoke($serviceLocator,null);
}
}
9 changes: 4 additions & 5 deletions src/GoalioForgotPassword/Form/Forgot.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

namespace GoalioForgotPassword\Form;

use Zend\Form\Element;
use ZfcBase\Form\ProvidesEventsForm;
use Laminas\Form\Element;
use Laminas\Form\Form;
use GoalioForgotPassword\Options\ForgotOptionsInterface;

class Forgot extends ProvidesEventsForm
class Forgot extends Form
{
/**
* @var AuthenticationOptionsInterface
*/
protected $forgotOptions;

public function __construct($name = null, ForgotOptionsInterface $options)
public function __construct($name, ForgotOptionsInterface $options)
{
$this->setForgotOptions($options);
parent::__construct($name);
Expand All @@ -36,7 +36,6 @@ public function __construct($name = null, ForgotOptionsInterface $options)
'priority' => -100,
));

$this->getEventManager()->trigger('init', $this);
}

public function setForgotOptions(ForgotOptionsInterface $forgotOptions)
Expand Down
4 changes: 3 additions & 1 deletion src/GoalioForgotPassword/Form/ForgotFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace GoalioForgotPassword\Form;

use Zend\InputFilter\InputFilter;
use Laminas\InputFilter\InputFilter;
use GoalioForgotPassword\Options\ForgotOptionsInterface;

class ForgotFilter extends InputFilter
Expand All @@ -12,6 +12,8 @@ class ForgotFilter extends InputFilter
*/
protected $options;

protected $emailValidator;

public function __construct( $emailValidator, ForgotOptionsInterface $options)
{
$this->setOptions($options);
Expand Down
10 changes: 4 additions & 6 deletions src/GoalioForgotPassword/Form/Reset.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@

namespace GoalioForgotPassword\Form;

use Zend\Form\Form;
use Zend\Form\Element;
use ZfcBase\Form\ProvidesEventsForm;
use Laminas\Form\Form;
use Laminas\Form\Element;
use GoalioForgotPassword\Options\ForgotOptionsInterface;

class Reset extends ProvidesEventsForm
class Reset extends Form
{
/**
* @var ForgotOptionsInterface
*/
protected $forgotOptions;

public function __construct($name = null, ForgotOptionsInterface $forgotOptions)
public function __construct($name, ForgotOptionsInterface $forgotOptions)
{
$this->setForgotOptions($forgotOptions);
parent::__construct($name);
Expand Down Expand Up @@ -50,7 +49,6 @@ public function __construct($name = null, ForgotOptionsInterface $forgotOptions)
'priority' => -100,
));

$this->getEventManager()->trigger('init', $this);
}

public function setForgotOptions(ForgotOptionsInterface $forgotOptions)
Expand Down
13 changes: 8 additions & 5 deletions src/GoalioForgotPassword/Form/ResetFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@

namespace GoalioForgotPassword\Form;

use ZfcBase\InputFilter\ProvidesEventsInputFilter as InputFilter;
use Laminas\InputFilter\InputFilter;
use GoalioForgotPassword\Options\ForgotOptionsInterface;

class ResetFilter extends InputFilter
{
public function __construct(ForgotOptionsInterface $options)
protected $passwordValidator;
public function __construct(ForgotOptionsInterface $options, $passwordValidator, $config)
{
$this->passwordValidator = $passwordValidator;
$this->add(array(
'name' => 'newCredential',
'required' => true,
'validators' => array(
array(
'name' => 'StringLength',
'options' => array(
'min' => 6,
'min' => $config['minPasswordLength'],
),
),
$this->passwordValidator,
),
'filters' => array(
array('name' => 'StringTrim'),
Expand All @@ -32,7 +35,7 @@ public function __construct(ForgotOptionsInterface $options)
array(
'name' => 'StringLength',
'options' => array(
'min' => 6,
'min' => $config['minPasswordLength'],
),
),
array(
Expand All @@ -41,12 +44,12 @@ public function __construct(ForgotOptionsInterface $options)
'token' => 'newCredential'
)
),
$this->passwordValidator,
),
'filters' => array(
array('name' => 'StringTrim'),
),
));

$this->getEventManager()->trigger('init', $this);
}
}
Loading