Knowledgebase

How to change the expiration time of temporary passwords in MediaWiki

When registered users who have forgotten their passwords reset them using the frontend form for resetting passwords, they receive an email message with a an automatically generated temporary password. They can use it to log into their account. The password is temporary and it has an expiration time. After that time passes the password can't be used anymore. By default, the expiration time of temporary passwords is set to 7 days.

If you want to, you can change that expiration time. You can do this by adding the variable $wgNewPasswordExpiry to the LocalSettings.php file of your MediaWiki. With the variable you can specify the expiration time in seconds. For example, if you add the following on a new line at the end of the LocalSettings.php file:

$wgNewPasswordExpiry = 3600 * 24 * 14;

the expiration time of temporary passwords will be set to 14 days (3600 seconds in an hour, multiplied by 24 hours in a day, multiplied by 14 days). An alternative is to add the variable with the total number for the seconds. For instance, if you add:

$wgNewPasswordExpiry = 1209600;

will set the temporary passwords to expire in 1209600 seconds which is the equivalent of 14 days.

The LocalSettings.php file that you have to edit is in the root MediaWiki folder on your MediaWiki hosting account. If, for example, MediaWiki is installed directly in the public_html directory on the account, the path to the file in relation to the directory will be public_html/LocalSettings.php. One way for HostKnox customers to edit files on the account without moving them is with the File manager of the Pixie control panel. An alternative is to download the file on your local computer, edit it with a text editor (e.g. Notepad ++) and upload it back overwriting the old file.

Here are some other articles related to user passwords that you may find useful:

Was this answer helpful?

 Print this Article

Also Read