Skip to content

Commit b9799d9

Browse files
author
Rafael Grigorian
committed
Fixed GH-9
1 parent 9356495 commit b9799d9

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
/**
4+
* Observer.php - This observer rewrites the observer found in the Enterprise_Pci module. It is
5+
* here in order to ensure 2FA authentication before forcing admin password change. The Pci
6+
* module is only available for EE versions of Magento and therefore this observer will only
7+
* run on enterprise versions of Magento.
8+
* @version 1.1.2
9+
* @package JetRails® TwoFactor
10+
* @category Model
11+
* @author Rafael Grigorian - JetRails®
12+
* @copyright JetRails®, all rights reserved
13+
*/
14+
class JetRails_TwoFactor_Model_Adminhtml_Rewrite_Observer extends Enterprise_Pci_Model_Observer {
15+
16+
/**
17+
* This method overrides the parent method. Before it executes the desired module behavior, it
18+
* makes sure that we are authenticated. If we are not authenticated, then we do not run the
19+
* forceAdminPasswordChange method from the parent.
20+
* @param Varien_Event_Observer observer Passed event observer
21+
* @return void
22+
*/
23+
public function forceAdminPasswordChange ( $observer ) {
24+
Mage::getSingleton ("twofactor/observer")->preAdminHtml ( $observer );
25+
$admin = Mage::getSingleton ("admin/session");
26+
if ( $admin->getTwoFactorAllow () === true ) {
27+
parent::forceAdminPasswordChange ( $observer );
28+
}
29+
return $observer;
30+
}
31+
32+
}

src/app/code/community/JetRails/TwoFactor/etc/config.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@
4141
</auth>
4242
</entities>
4343
</twofactor_resource>
44+
<enterprise_pci>
45+
<rewrite>
46+
<observer>JetRails_TwoFactor_Model_Adminhtml_Rewrite_Observer</observer>
47+
</rewrite>
48+
</enterprise_pci>
4449
</models>
4550
<resources>
4651
<jetrails_twofactor_setup>
@@ -78,6 +83,15 @@
7883
</twofactor_redirect>
7984
</observers>
8085
</controller_action_predispatch>
86+
<admin_user_authenticate_after>
87+
<observers>
88+
<twofactor_redirect_after_auth>
89+
<type>singleton</type>
90+
<class>twofactor/observer</class>
91+
<method>preAdminHtml</method>
92+
</twofactor_redirect_after_auth>
93+
</observers>
94+
</admin_user_authenticate_after>
8195
</events>
8296
<layout>
8397
<updates>

0 commit comments

Comments
 (0)