Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair the application error loop #663

Open
wants to merge 87 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
206ead0
Fix login/logout redirect method
Danielss89 Jun 8, 2014
6dd4372
Change redirect strategy
Danielss89 Jul 3, 2014
d1b7b94
Convert short array to long array
Danielss89 Jul 3, 2014
b59b674
Fix config alignment
Danielss89 Jul 3, 2014
6d26b6b
Change methods visibility
Danielss89 Jul 3, 2014
4036d0c
Merge pull request #487 from Eye4web/1.x
Danielss89 Jul 3, 2014
69e8d57
Changing the getRedirect function to protected as I need to extend th…
shipleyr Jul 9, 2014
b14785a
pass changePassword and changeEmail data to event
Jul 9, 2014
2a4659f
Fix caching closure
Danielss89 Jul 14, 2014
7b499ce
Merge pull request #503 from Eye4web/config-closure-fix
Danielss89 Jul 14, 2014
19d8fe1
Merge pull request #498 from shipleyr/bugfix/method-visibility
Danielss89 Aug 8, 2014
5b6b691
closes #511
Aug 8, 2014
5fa6ecb
Merge pull request #512 from Eye4web/session-fix
Danielss89 Aug 8, 2014
5341347
Fix redirect after register
BnitoBzh Sep 3, 2014
36f962b
Update RedirectCallback.php
BnitoBzh Sep 3, 2014
a08a904
Merge pull request #521 from BnitoBzh/patch-1
Danielss89 Sep 3, 2014
e868d11
Merge pull request #499 from MalteGerth/patch-1
Danielss89 Oct 4, 2014
a8231be
Fix test suite failure intoduced in #511
adamlundrigan Oct 29, 2014
f57949e
Remove default user state value check during registration process
adamlundrigan Oct 29, 2014
18a0476
Merge pull request #535 from adamlundrigan/hotfix/534
Danielss89 Oct 29, 2014
1827610
Merge pull request #536 from adamlundrigan/hotfix/523
Danielss89 Oct 29, 2014
baf0e46
Fix XSS vulnerability
Danielss89 Jan 8, 2015
947929a
- add password type outside attributes to get correct Entity
claytondaley Jan 28, 2015
c36e8c8
- fixed password everywhere in case it ever affects an inheriting user
claytondaley Jan 28, 2015
d9b27aa
- move registration dependencies from Base constructor to Registrati…
claytondaley Jan 28, 2015
2d9ba98
Merge pull request #562 from claytondaley/password-entities-1.x
Danielss89 Feb 1, 2015
8c22795
- try fixing tests
claytondaley Feb 1, 2015
da66b76
- move provider annotation
claytondaley Feb 1, 2015
b7d5335
- fixed class use
claytondaley Feb 1, 2015
28b4ae2
- actually set $useCaptcha in settings
claytondaley Feb 1, 2015
5afcf6e
- "The closing brace for the class must go on the next line after th…
claytondaley Feb 1, 2015
e91ea22
Add translation for Czech language
vagovszky Feb 9, 2015
2d1ed74
Merge pull request #567 from vagovszky/czech-lang-1.x
Danielss89 Feb 9, 2015
5dc80d9
Translation typo
vagovszky Feb 9, 2015
afcbfe3
Merge pull request #569 from vagovszky/czech-lang-1.x
Danielss89 Feb 9, 2015
9392a4b
Merge pull request #564 from claytondaley/fix-base-form-1.x
Danielss89 Mar 14, 2015
0d1c7ba
Upgrade Forms:
claytondaley Feb 7, 2015
46bc132
- restore original tests
claytondaley Mar 22, 2015
739ba8c
- Prepared to restore backwards compatibility
claytondaley Mar 22, 2015
af4f040
IsEmpty check in storage should not trigger additional read from the …
Apr 29, 2015
3035a25
- Dirty hack to pass in FormElementManager state
claytondaley May 6, 2015
c3dccbd
- fix styling issues
claytondaley May 6, 2015
b1b6835
- revert attempt to dynamically call `init()` in constructor based o…
claytondaley May 6, 2015
1924ae6
- move remaining closures from Module to factory
claytondaley May 6, 2015
d8eedbb
- fix formatting
claytondaley May 7, 2015
325d235
- final formatting issue
claytondaley May 7, 2015
c0a03db
Update README.md
johnnypeck May 9, 2015
ca617b9
Merge pull request #587 from johnnypeck/patch-1
Danielss89 May 9, 2015
58d92fa
pt_BR translation
mihailov-vf May 21, 2015
da69d67
update pt_BR translation
mihailov-vf May 21, 2015
ec57a78
Merge pull request #588 from mihailov-vf/1.x
Danielss89 May 21, 2015
d0d9c81
Add parameter autocomplete = off on forms with password.
adelarcubs Jun 17, 2015
d5a8513
Fixed spelling of comment in zfcuser.global.php.dist
chukShirley Jun 26, 2015
8aaf0d7
Merge pull request #595 from chukShirley/comment-typo
Danielss89 Jun 26, 2015
acda2eb
Merge pull request #592 from adelarcubs/1.x
Danielss89 Jul 20, 2015
2d93d26
- revert travis and .gitignore
claytondaley Jul 20, 2015
a3ec479
Add zfcuser/authenticate to redirectCallback check
Danielss89 Aug 17, 2015
6bc1372
Merge pull request #600 from Eye4web/missingLoginRedirectRoute
Danielss89 Aug 17, 2015
7947c97
- use partials
claytondaley Oct 17, 2015
9fc3a93
Update README.md
Rockstar04 Nov 23, 2015
331162b
Update PHP version constraint to allow PHP 7
adamlundrigan Dec 12, 2015
65c17c7
Merge pull request #608 from adamlundrigan/composer-php-version
Danielss89 Dec 12, 2015
089094f
Merge pull request #606 from Rockstar04/patch-1
Danielss89 Dec 12, 2015
6e286ef
Merge pull request #585 from mailjet/1.x
Danielss89 Dec 12, 2015
c7aa895
Merge pull request #578 from claytondaley/form-upgrades
Danielss89 Dec 12, 2015
44cb298
Fix factories returning themselves
Danielss89 Dec 12, 2015
2277c59
Merge pull request #609 from Eye4web/factory-fix
Danielss89 Dec 12, 2015
b5689f5
Fixed zfcuser_login_form service in ZfcUserLoginWidget view helper
nepda Dec 14, 2015
e755d96
Merge pull request #610 from nepda/zfc-1.x
Danielss89 Dec 15, 2015
c524269
Pass form object along to form partial
Danielss89 Dec 21, 2015
9f54582
Revert usage of formElementManager(BC break)
Danielss89 Dec 21, 2015
d8f83a3
Move form factories to factories key, instead of invokables key
Danielss89 Dec 21, 2015
c6a260c
do not allow 5.6 failures and add php7 to test matrix
svycka Mar 4, 2016
fd103f7
Merge pull request #624 from svycka/patch-1
Danielss89 Mar 7, 2016
f93a182
Fix controller getServiceLocator deprecation notice
Danielss89 May 5, 2016
9806b9c
Fix ServiceManagerAwareInitializer deprecation notices
Danielss89 May 5, 2016
a89e622
Actually inject controller dependencies
Danielss89 May 5, 2016
c447f6e
Fix controller tests
Danielss89 May 5, 2016
647e2fc
Merge pull request #637 from Eye4web/hotfix/servicemanager
Danielss89 May 5, 2016
65a57a4
Remove old "use" statements for ServiceManagerAwareInterface
Danielss89 May 7, 2016
d268835
Remove ServiceManagerAwareInterface from User service
Danielss89 May 7, 2016
3150e67
Fix usage of servicelocator in UserControllerFactory
Danielss89 May 7, 2016
f3d5fab
Merge pull request #639 from Eye4web/hotfix/servicemanager
Danielss89 May 7, 2016
0d225b1
Spanish translation
May 25, 2016
00fe029
Merge pull request #641 from matiasiglesias/1.x
Danielss89 Jul 8, 2016
27e8598
Update RegisterFilter.php
corneliu-iancu Jul 8, 2016
c727fec
Merge pull request #644 from Socratemus/patch-1
Danielss89 Jul 8, 2016
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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ php:
- 5.4
- 5.5
- 5.6
- 7.0
- hhvm

before_script:
Expand All @@ -28,5 +29,4 @@ notifications:
matrix:
fast_finish: true
allow_failures:
- php: 5.6
- php: hhvm
132 changes: 29 additions & 103 deletions Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@

namespace ZfcUser;

use Zend\ModuleManager\ModuleManager;
use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
use Zend\ModuleManager\Feature\ConfigProviderInterface;
use Zend\ModuleManager\Feature\ServiceProviderInterface;
use Zend\Stdlib\Hydrator\ClassMethods;

class Module implements
AutoloaderProviderInterface,
Expand Down Expand Up @@ -36,15 +34,16 @@ public function getControllerPluginConfig()
{
return array(
'factories' => array(
'zfcUserAuthentication' => function ($sm) {
$serviceLocator = $sm->getServiceLocator();
$authService = $serviceLocator->get('zfcuser_auth_service');
$authAdapter = $serviceLocator->get('ZfcUser\Authentication\Adapter\AdapterChain');
$controllerPlugin = new Controller\Plugin\ZfcUserAuthentication;
$controllerPlugin->setAuthService($authService);
$controllerPlugin->setAuthAdapter($authAdapter);
return $controllerPlugin;
},
'zfcUserAuthentication' => 'ZfcUser\Factory\Controller\Plugin\ZfcUserAuthentication',
),
);
}

public function getControllerConfig()
{
return array(
'factories' => array(
'zfcuser' => 'ZfcUser\Factory\Controller\UserControllerFactory',
),
);
}
Expand All @@ -53,25 +52,9 @@ public function getViewHelperConfig()
{
return array(
'factories' => array(
'zfcUserDisplayName' => function ($sm) {
$locator = $sm->getServiceLocator();
$viewHelper = new View\Helper\ZfcUserDisplayName;
$viewHelper->setAuthService($locator->get('zfcuser_auth_service'));
return $viewHelper;
},
'zfcUserIdentity' => function ($sm) {
$locator = $sm->getServiceLocator();
$viewHelper = new View\Helper\ZfcUserIdentity;
$viewHelper->setAuthService($locator->get('zfcuser_auth_service'));
return $viewHelper;
},
'zfcUserLoginWidget' => function ($sm) {
$locator = $sm->getServiceLocator();
$viewHelper = new View\Helper\ZfcUserLoginWidget;
$viewHelper->setViewTemplate($locator->get('zfcuser_module_options')->getUserLoginWidgetViewTemplate());
$viewHelper->setLoginForm($locator->get('zfcuser_login_form'));
return $viewHelper;
},
'zfcUserDisplayName' => 'ZfcUser\Factory\View\Helper\ZfcUserDisplayName',
'zfcUserIdentity' => 'ZfcUser\Factory\View\Helper\ZfcUserIdentity',
'zfcUserLoginWidget' => 'ZfcUser\Factory\View\Helper\ZfcUserLoginWidget',
),
);

Expand All @@ -80,91 +63,34 @@ public function getViewHelperConfig()
public function getServiceConfig()
{
return array(
'aliases' => array(
'zfcuser_zend_db_adapter' => 'Zend\Db\Adapter\Adapter',
),
'invokables' => array(
'ZfcUser\Authentication\Adapter\Db' => 'ZfcUser\Authentication\Adapter\Db',
'ZfcUser\Authentication\Storage\Db' => 'ZfcUser\Authentication\Storage\Db',
'ZfcUser\Form\Login' => 'ZfcUser\Form\Login',
'zfcuser_user_service' => 'ZfcUser\Service\User',
'zfcuser_register_form_hydrator' => 'Zend\Stdlib\Hydrator\ClassMethods',
),
'factories' => array(
'zfcuser_redirect_callback' => 'ZfcUser\Factory\Controller\RedirectCallbackFactory',
'zfcuser_module_options' => 'ZfcUser\Factory\Options\ModuleOptions',
'ZfcUser\Authentication\Adapter\AdapterChain' => 'ZfcUser\Authentication\Adapter\AdapterChainServiceFactory',

'zfcuser_module_options' => function ($sm) {
$config = $sm->get('Config');
return new Options\ModuleOptions(isset($config['zfcuser']) ? $config['zfcuser'] : array());
},
// We alias this one because it's ZfcUser's instance of
// Zend\Authentication\AuthenticationService. We don't want to
// hog the FQCN service alias for a Zend\* class.
'zfcuser_auth_service' => function ($sm) {
return new \Zend\Authentication\AuthenticationService(
$sm->get('ZfcUser\Authentication\Storage\Db'),
$sm->get('ZfcUser\Authentication\Adapter\AdapterChain')
);
},

'ZfcUser\Authentication\Adapter\AdapterChain' => 'ZfcUser\Authentication\Adapter\AdapterChainServiceFactory',

'zfcuser_login_form' => function ($sm) {
$options = $sm->get('zfcuser_module_options');
$form = new Form\Login(null, $options);
$form->setInputFilter(new Form\LoginFilter($options));
return $form;
},

'zfcuser_register_form' => function ($sm) {
$options = $sm->get('zfcuser_module_options');
$form = new Form\Register(null, $options);
//$form->setCaptchaElement($sm->get('zfcuser_captcha_element'));
$form->setInputFilter(new Form\RegisterFilter(
new Validator\NoRecordExists(array(
'mapper' => $sm->get('zfcuser_user_mapper'),
'key' => 'email'
)),
new Validator\NoRecordExists(array(
'mapper' => $sm->get('zfcuser_user_mapper'),
'key' => 'username'
)),
$options
));
return $form;
},
'zfcuser_auth_service' => 'ZfcUser\Factory\AuthenticationService',

'zfcuser_change_password_form' => function ($sm) {
$options = $sm->get('zfcuser_module_options');
$form = new Form\ChangePassword(null, $sm->get('zfcuser_module_options'));
$form->setInputFilter(new Form\ChangePasswordFilter($options));
return $form;
},
'zfcuser_user_hydrator' => 'ZfcUser\Factory\UserHydrator',
'zfcuser_user_mapper' => 'ZfcUser\Factory\Mapper\User',

'zfcuser_change_email_form' => function ($sm) {
$options = $sm->get('zfcuser_module_options');
$form = new Form\ChangeEmail(null, $options);
$form->setInputFilter(new Form\ChangeEmailFilter(
$options,
new Validator\NoRecordExists(array(
'mapper' => $sm->get('zfcuser_user_mapper'),
'key' => 'email'
))
));
return $form;
},
'zfcuser_login_form' => 'ZfcUser\Factory\Form\Login',
'zfcuser_register_form' => 'ZfcUser\Factory\Form\Register',
'zfcuser_change_password_form' => 'ZfcUser\Factory\Form\ChangePassword',
'zfcuser_change_email_form' => 'ZfcUser\Factory\Form\ChangeEmail',

'zfcuser_user_hydrator' => function ($sm) {
$hydrator = new \Zend\Stdlib\Hydrator\ClassMethods();
return $hydrator;
},
'ZfcUser\Authentication\Adapter\Db' => 'ZfcUser\Factory\Authentication\Adapter\DbFactory',
'ZfcUser\Authentication\Storage\Db' => 'ZfcUser\Factory\Authentication\Storage\DbFactory',

'zfcuser_user_mapper' => function ($sm) {
$options = $sm->get('zfcuser_module_options');
$mapper = new Mapper\User();
$mapper->setDbAdapter($sm->get('zfcuser_zend_db_adapter'));
$entityClass = $options->getUserEntityClass();
$mapper->setEntityPrototype(new $entityClass);
$mapper->setHydrator(new Mapper\UserHydrator());
$mapper->setTableName($options->getTableName());
return $mapper;
},
'zfcuser_user_service' => 'ZfcUser\Factory\Service\UserFactory',
),
);
}
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ ZfcUser is a user registration and authentication module for Zend Framework 2.
Out of the box, ZfcUser works with Zend\Db, however alternative storage adapter
modules are available (see below). ZfcUser provides the foundations for adding
user authentication and registration to your ZF2 site. It is designed to be very
simple and easily to extend.
simple and easy to extend.

More information and examples are available on the [ZfcUser Wiki](https://github.com/ZF-Commons/ZfcUser/wiki)

Expand Down Expand Up @@ -86,7 +86,6 @@ Installation
return array(
'modules' => array(
// ...
'ZfcBase',
'ZfcUser',
),
// ...
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
},
"require": {
"php": ">=5.3.3",
"php": "^5.3.3|~7.0",
"zendframework/zend-authentication": "~2.1",
"zendframework/zend-crypt": "~2.1",
"zendframework/zend-form": "~2.1",
Expand Down
12 changes: 2 additions & 10 deletions config/module.config.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,12 @@
<?php

return array(
'view_manager' => array(
'template_path_stack' => array(
'zfcuser' => __DIR__ . '/../view',
),
),
'controllers' => array(
'invokables' => array(
'zfcuser' => 'ZfcUser\Controller\UserController',
),
),
'service_manager' => array(
'aliases' => array(
'zfcuser_zend_db_adapter' => 'Zend\Db\Adapter\Adapter',
),
),

'router' => array(
'routes' => array(
'zfcuser' => array(
Expand Down
2 changes: 1 addition & 1 deletion config/zfcuser.global.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ $settings = array(
/**
* Logout Redirect Route
*
* Upon logging out the user will be redirected to the enterd route
* Upon logging out the user will be redirected to the entered route
*
* Default value: 'zfcuser/login'
* Accepted values: A valid route name within your application
Expand Down
7 changes: 2 additions & 5 deletions src/ZfcUser/Authentication/Adapter/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,15 @@

namespace ZfcUser\Authentication\Adapter;

use DateTime;
use Zend\Authentication\Result as AuthenticationResult;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Zend\ServiceManager\ServiceManager;
use Zend\Crypt\Password\Bcrypt;
use Zend\Session\Container as SessionContainer;
use ZfcUser\Authentication\Adapter\AdapterChainEvent as AuthEvent;
use ZfcUser\Mapper\User as UserMapperInterface;
use ZfcUser\Options\AuthenticationOptionsInterface;

class Db extends AbstractAdapter implements ServiceManagerAwareInterface
class Db extends AbstractAdapter
{
/**
* @var UserMapperInterface
Expand Down Expand Up @@ -40,8 +38,7 @@ class Db extends AbstractAdapter implements ServiceManagerAwareInterface
*/
public function logout(AuthEvent $e)
{
$session = new SessionContainer($this->getStorage()->getNameSpace());
$session->getManager()->destroy();
$this->getStorage()->clear();
}

public function authenticate(AuthEvent $e)
Expand Down
5 changes: 2 additions & 3 deletions src/ZfcUser/Authentication/Storage/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@

use Zend\Authentication\Storage;
use Zend\Authentication\Storage\StorageInterface;
use Zend\ServiceManager\ServiceManagerAwareInterface;
use Zend\ServiceManager\ServiceManager;
use ZfcUser\Mapper\UserInterface as UserMapper;

class Db implements Storage\StorageInterface, ServiceManagerAwareInterface
class Db implements Storage\StorageInterface
{
/**
* @var StorageInterface
Expand Down Expand Up @@ -42,7 +41,7 @@ public function isEmpty()
if ($this->getStorage()->isEmpty()) {
return true;
}
$identity = $this->read();
$identity = $this->getStorage()->read();
if ($identity === null) {
$this->clear();
return true;
Expand Down
Loading