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

Fix hardcoded Login module references #8807

Merged
merged 1 commit into from Sep 20, 2015

Conversation

Joey3000
Copy link
Contributor

This does following:

I. Fixes hardcoded use of the Login plugin name:

  1. For plugins/Login/Login.php, this prevents the "Login plugin not active" exception page appearances. Those can be reproduced using following simple test (just an example):

    a. Install and activate another Login module (tested with LoginEncrypted - the core Login plugin will be automatically deactivated)
    b. Add another user and set it to be super user as well
    c. Log out and log back in as the newly created super user
    d. Delete the newly created super-user (i.e. oneself)
    ==> Instead of the login page, a "Login plugin not active" exception page appears

  2. For plugins/Login/Controller.php, this corrects the displayed link to the login page. To reproduce (just an example):

    a. Send an ajax request with no access; or: patch in a new Exception somewhere (e.g. at the beginning of plugins/Login/Login.php->login() and load the login page) showing the return of plugins/Login/Controller.php->ajaxNoAccess()

II. Fixes an inconsistency in obtaining the name of the currently active Login module in core/Plugin/Controller.php. It should, like any other module, use Piwik::getLoginPluginName() instead of replicating it by accessing StaticContainer::get('Piwik\Auth')->getName() directly. This was done to prevent possible future issues in case that Piwik::getLoginPluginName() changes.

P.S.: Note to the point (I) above: Please note that checking, within the Login plugin code, which Login module is currently active is nothing new. Because the core Login module code is called also when the plugin is disabled, it already needs to find it out, as it does e.g. in https://github.com/piwik/piwik/blob/2.15.0-b7/plugins/Login/Login.php#L74 (using a released version as example, just so that the line number does not change in future).

Replaced with the official Piwik::getLoginPluginName()
@Joey3000
Copy link
Contributor Author

Another case of a hard-coded Login plugin name is in the following issue report: #8808

@Joey3000 Joey3000 changed the title Fixed hardcoded Login module references Fix hardcoded Login module references Sep 17, 2015
mattab pushed a commit that referenced this pull request Sep 20, 2015
Fix hardcoded Login module references
@mattab mattab merged commit ab0765a into matomo-org:master Sep 20, 2015
@mattab
Copy link
Member

mattab commented Sep 20, 2015

Thanks @Joey3000 for the pull request 👍

@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Sep 20, 2015
@mattab mattab added this to the 2.15.0 milestone Sep 20, 2015
@Joey3000 Joey3000 deleted the fixHardcodedLogin branch September 20, 2015 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants