diff --git a/application/controllers/admin/authentication.php b/application/controllers/admin/authentication.php
index 20e3a7b7641..384ad6de1c1 100644
--- a/application/controllers/admin/authentication.php
+++ b/application/controllers/admin/authentication.php
@@ -110,14 +110,14 @@ public function logout()
/* Adding beforeLogout event */
$beforeLogout = new PluginEvent('beforeLogout');
- App()->getPluginManager()->dispatchEvent($beforeLogout, array($plugin));
+ App()->getPluginManager()->dispatchEvent($beforeLogout);
App()->user->logout();
App()->user->setFlash('loginmessage', gT('Logout successful.'));
/* Adding afterLogout event */
$event = new PluginEvent('afterLogout');
- App()->getPluginManager()->dispatchEvent($event, array($plugin));
+ App()->getPluginManager()->dispatchEvent($event);
$this->getController()->redirect(array('/admin/authentication/sa/login'));
}
diff --git a/application/core/LSUserIdentity.php b/application/core/LSUserIdentity.php
index 8cfeda29d8d..5e56eb3694f 100644
--- a/application/core/LSUserIdentity.php
+++ b/application/core/LSUserIdentity.php
@@ -66,7 +66,7 @@ public function authenticate() {
// Delegate actual authentication to plugin
$authEvent = new PluginEvent('newUserSession', $this);
$authEvent->set('identity', $this);
- App()->getPluginManager()->dispatchEvent($authEvent, array($this->plugin));
+ App()->getPluginManager()->dispatchEvent($authEvent);
$pluginResult = $authEvent->get('result');
if ($pluginResult instanceof LSAuthResult) {
$result = $pluginResult;
diff --git a/application/core/plugins/AuthLDAP/AuthLDAP.php b/application/core/plugins/AuthLDAP/AuthLDAP.php
index 1cd4933450d..f9dacf44a9d 100644
--- a/application/core/plugins/AuthLDAP/AuthLDAP.php
+++ b/application/core/plugins/AuthLDAP/AuthLDAP.php
@@ -108,16 +108,6 @@ public function newLoginForm()
->addContent(CHtml::tag('li', array(), ""));
}
- public function afterLoginFormSubmit()
- {
- // Here we handle post data
- $request = $this->api->getRequest();
- if ($request->getIsPostRequest()) {
- $this->setUsername( $request->getPost('user'));
- $this->setPassword($request->getPost('password'));
- }
- }
-
/**
* Modified getPluginSettings since we have a select box that autosubmits
* and we only want to show the relevant options.
@@ -166,6 +156,13 @@ public function getPluginSettings($getValues = true)
public function newUserSession()
{
+ // Do nothing if this user is not Authdb type
+ $identity = $this->getEvent()->get('identity');
+ if ($identity->plugin != 'AuthLDAP')
+ {
+ return;
+ }
+
// Here we do the actual authentication
$username = $this->getUsername();
$password = $this->getPassword();
diff --git a/application/core/plugins/Authdb/Authdb.php b/application/core/plugins/Authdb/Authdb.php
index 131af6782fe..2accf7dcbde 100644
--- a/application/core/plugins/Authdb/Authdb.php
+++ b/application/core/plugins/Authdb/Authdb.php
@@ -75,18 +75,15 @@ public function newLoginForm()
->addContent(CHtml::tag('li', array(), "".CHtml::passwordField('password',$sPassword,array('size'=>40,'maxlength'=>40))));
}
- public function afterLoginFormSubmit()
+ public function newUserSession()
{
- // Here we handle post data
- $request = $this->api->getRequest();
- if ($request->getIsPostRequest()) {
- $this->setUsername( $request->getPost('user'));
- $this->setPassword($request->getPost('password'));
+ // Do nothing if this user is not Authdb type
+ $identity = $this->getEvent()->get('identity');
+ if ($identity->plugin != 'Authdb')
+ {
+ return;
}
- }
- public function newUserSession()
- {
// Here we do the actual authentication
$username = $this->getUsername();
$password = $this->getPassword();
diff --git a/application/core/plugins/Authwebserver/Authwebserver.php b/application/core/plugins/Authwebserver/Authwebserver.php
index 73231e06f8a..d9271a7ba44 100644
--- a/application/core/plugins/Authwebserver/Authwebserver.php
+++ b/application/core/plugins/Authwebserver/Authwebserver.php
@@ -72,6 +72,13 @@ public function beforeLogin()
public function newUserSession()
{
+ // Do nothing if this user is not Authdb type
+ $identity = $this->getEvent()->get('identity');
+ if ($identity->plugin != 'Authwebserver')
+ {
+ return;
+ }
+
/* @var $identity LSUserIdentity */
$sUser = $this->getUserName();
diff --git a/application/libraries/PluginManager/AuthPluginBase.php b/application/libraries/PluginManager/AuthPluginBase.php
index 7ec7ef6919a..8d97b63819e 100644
--- a/application/libraries/PluginManager/AuthPluginBase.php
+++ b/application/libraries/PluginManager/AuthPluginBase.php
@@ -34,7 +34,22 @@ protected function getUserName()
{
return $this->_username;
}
-
+
+ /**
+ * Set username and password
+ *
+ * @return null
+ */
+ public function afterLoginFormSubmit()
+ {
+ // Here we handle post data
+ $request = $this->api->getRequest();
+ if ($request->getIsPostRequest()) {
+ $this->setUsername( $request->getPost('user'));
+ $this->setPassword($request->getPost('password'));
+ }
+ }
+
/**
* Set authentication result to success for the given user object.
*