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.

Syspect
  • 1,283
  • 4
  • 22
  • 37
  • 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

1 Answers1

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)".

Matthias Zeis
  • 7,697
  • 3
  • 32
  • 50
  • Could you please provide full path – insoftservice Feb 01 '19 at 02: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: https://inchoo.net/magento/overriding-magento-blocks-models-helpers-and-controllers/ – Matthias Zeis Feb 02 '19 at 07: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 04 '19 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 05 '19 at 20:14