On Magento EE if you go to System > Configuration > Advanced > Admin > Security their is an option to set Password Change to Forced.

enter image description here

If we do this and someone has an expired password will it lock them out - or will it allow them login but force them to update their password?

I've tried looking through the Magento User Guide & Wiki but could find no answer :(

5 Answers 5


I went into one of our Enterprise installs to check this.

In app/code/core/Enterprise/Pci/Model/Observer.php there is a function called adminAuthenticate in the Observer.

public function adminAuthenticate($observer)

First, it updates the locking information:

    // update locking information regardless whether user locked or not
    if ((!$authResult) && ($user->getId())) {
        $now = time();
        $lockThreshold = $this->getAdminLockThreshold();
        $maxFailures = (int)Mage::getStoreConfig('admin/security/lockout_failures');
        if (!($lockThreshold && $maxFailures)) {
        $failuresNum = (int)$user->getFailuresNum() + 1;
        if ($firstFailureDate = $user->getFirstFailure()) {
            $firstFailureDate = new Zend_Date($firstFailureDate, Varien_Date::DATETIME_INTERNAL_FORMAT);
            $firstFailureDate = $firstFailureDate->toValue();

Then it determines if the admin account is locked out by checking the lockExpires field from admin_user against the current time.

    // check whether user is locked
    if ($lockExpires = $user->getLockExpires()) {
        $lockExpires = new Zend_Date($lockExpires, Varien_Date::DATETIME_INTERNAL_FORMAT);
        $lockExpires = $lockExpires->toValue();
        if ($lockExpires > time()) {
            throw new Mage_Core_Exception(
                Mage::helper('enterprise_pci')->__('This account is locked.'),

Then it pulls the latest password and checks to see if the admin has to complete a forced password change.

$latestPassword = Mage::getResourceSingleton('enterprise_pci/admin_user')->getLatestPassword($user->getId());
    if ($latestPassword) {
        if ($this->_isLatestPasswordExpired($latestPassword)) {
            if ($this->isPasswordChangeForced()) {
                $message = Mage::helper('enterprise_pci')->__('Your password has expired, you must change it now.');
            } else {
                $myAccountUrl = Mage::getSingleton('adminhtml/url')->getUrl('adminhtml/system_account/');
                $message = Mage::helper('enterprise_pci')->__('Your password has expired, please <a href="%s">change it</a>.', $myAccountUrl);
            if ($message = Mage::getSingleton('adminhtml/session')->getMessages()->getLastAddedMessage()) {

If the getPciAdminUserIsPasswordExpired session variable is set, then it is caught in the forceAdminPasswordChange function in controller_action_predispatch.

public function forceAdminPasswordChange($observer)
    if (!$this->isPasswordChangeForced()) {
    $session = Mage::getSingleton('admin/session');
    if (!$session->isLoggedIn()) {
    $actionList = array('adminhtml_system_account_index', 'adminhtml_system_account_save',
    $controller = $observer->getEvent()->getControllerAction();
    if (Mage::getSingleton('admin/session')->getPciAdminUserIsPasswordExpired()) {
        if (!in_array($controller->getFullActionName(), $actionList)) {
            if (Mage::getSingleton('admin/session')->isAllowed('admin/system/myaccount')) {
                $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
                $controller->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_POST_DISPATCH, true);
            } else {
                 * if admin password is expired and access to 'My Account' page is denied
                 * than we need to do force logout with error message
                    Mage::helper('enterprise_pci')->__('Your password has expired, please contact administrator.')

If the Admin user has a forced password flag set and is allowed to access My Account then they'll be able to update their password themselves. If not, then they'll be logged out with the message Your password has expired, please contact administrator.


Magento will redirect them to /admin/system_account/index/ and offer to change their password. Untill they change it, they won't be able to use Admin panel. So yes, it will lock them out. But take in mind, that feature works for Admin panel's users only.

  • thanks. How did you discover this? Did you see this in the code? I'm trying to test it but I have to wait a day for my password to expire.
    – Holly
    Jan 22, 2015 at 16:25
  • \app\code\core\Enterprise\Pci\Model\Observer.php <br/> (263) public function forceAdminPasswordChange($observer) Arrrgh... those line breaks. Just for test I've commented out if (!$this->isPasswordChangeForced()) part and if (Mage::getSingleton('admin/session')->getPciAdminUserIsPasswordExpired()) I've set to true. Don't forget to undo your changes after test.
    – Amberta
    Jan 22, 2015 at 16:28
  • You wouldn't have to comment out !this->isPasswordChangeForced() because that is just pulling the admin setting. Jan 22, 2015 at 16:44
  • Yes, it's not necessary if your configuration "Password Change" set to "Forced". In my case this part was returning True, because I turned it off on my local environment.
    – Amberta
    Jan 22, 2015 at 18:25

This is definitely a bug. We discovered the same problem on our installation of EE 1.14.1. Magento provided a patch to fix the problem. It was patch PATCH_SUPEE-5151_EE_1.14.1.0_v1.sh. If you ask them to reference their support case number 236942, they will be able to find it and send it to you (or make it available in the downloads section of your account).


The description of functionality is nice seanbreeden. The problem is that we cannot enforce password change at any moment as needed. If we chose to use this password change enforcement feature this will produce no instant effect.

The password change enforcement as it is on magento EE first needs the user to change or reset their password, and only at this moment one hashed record and the expiration time will be added in enterprise_admin_password table. Yet there are no effects till the day when the password will expire based on the password lifetime we set at System > Configuration > Advanced > Admin > Security.

If the admin users will never change the password voluntary, they will be never enforced to change since there are no records for that user on enterprise_admin_password table.

My answer is that there is no true enforcement for admin password change.

But other than this it makes sense to get locked out if you are enforced to change the password when that time will come, just change it and you will be able to login and fully access the admin site, it worked for me.


Unfortunately it is an all or nothing setting.

If you want to require users to change their password x-days, but allow a user used for an API to have a permanent password, you are out of luck.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.