7

So I need to reduce the time after which the password-reset link expires, because right now it is either too long, or doesn't expire at all...

I tried looking up in System/Configuration/Admin... but f.e. in Security (as I saw an example) I don't have Password Lifetimeor Password Change fields. Actually - nothing connected to password.

So any suggestions ?

Update: I found another setting -> Recovery Link Expiration Period (days) in System/Configuration/Admin/Admin User Emails but the minimum is 1 day... and I need something like 2 minutes.

Is it possible to change it somehow through the DB with some query or with an installation script ? I mean - change the whole setting (to be in minutes, for example), but not only the number.

  • 1
    You don'T want to have 2 minutes. Some systems, especially if the mails are checked with 3 virus scanners can take up to 10min. If you only check the external SMTP every 10min, it can take up to 20min before the mail arrives. Just my 2 cents. – Fabian Blechschmidt Oct 13 '13 at 20:17
5

To accomplish this you have to create your own extension and rewrite Mage_Admin_Model_User.

In your class you rewrite the method isResetPasswordLinkTokenExpired() and replace

    $dayDifference = floor(($currentTimestamp - $tokenTimestamp) / (24 * 60 * 60));
    if ($dayDifference >= $tokenExpirationPeriod) {
        return true;
    }

with

    $minuteDifference = floor(($currentTimestamp - $tokenTimestamp) / 60);
    if ($minuteDifference >= $tokenExpirationPeriod) {
        return true;
    }

You will also want to create your own system.xml file and change the option description from "Recovery Link Expiration Period (days)" to "Recovery Link Expiration Period (minutes)".

  • Could you please provide full path – insoftservice Feb 1 at 2:46
  • The original file is located at app/code/core/Mage/Admin/Model/User.php. Don't edit the original file, but create your own extension and rewrite the model. Here is one example how to do this: inchoo.net/magento/… – Matthias Zeis Feb 2 at 7:14
  • Thx for your comments @Matthias but i did not found this file later realized that magento 1.7 and magento 2.* folder structure have been completely changed. Could you please guide me in it . I was able to change the text by changing in /vendor/magento/magento-backend/i18n/en_US.csv – insoftservice Feb 4 at 19:01
  • Sorry, I don't have the answer at hand. Please post a new question for Magento 2, somebody should be able to help you pretty quickly. – Matthias Zeis Feb 5 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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