How to Remove Joomla's “Forget Username” and “Forget Password” Links
- by Naveen Kumar
- on Tutorials
Do you own a Joomla website? Or are you an admin or a Joomla website? And you may be very cautious about the security of your website and this can be the reason you want to hide or remove “Forget Username” and “Forget Password” links from your Joomla login page.
There can be many other reasons as well. So in this article, we are going to learn how to modify the login page and remove the “Forget Username” and “Forget Password” links.
Note: To remove these links from the login page, you need to edit the template files. And if you have accidentally removed anything else, your website can stop functioning. So it is highly recommended to take a full backup of your website before making any changes in the files.
Step 1 - Remove the Links From the Users Component
The very first step you need to do is to remove the links from Com_Users. To do this, navigate to Extensions > Templates > Templates.
Look for the default template you are using on your website. It will be named like Your_Template_Name Details and Files. Click on it.
Now, you have to create an override for the login file. So now navigate to the Create Overrides tab and find Com_Users under the Component section and click on login.
This will generate a set of files in .templates/your-template-name/html/com_users/login/. Now, navigate to the Editor tab and choose the file located in /html/com_users/login/default_login.php.
Click on it to edit the file. Find below the given code and remove it from the file. This code can be different depending upon your template. I am using Astroid Template One for this example.
<ul class="list-group mt-3"<
<ul class="list-group mt-3">
<li class="list-group-item">
<a href="/<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?a>">
<?php echo JText::_('COM_USERS_LOGIN_RESET'); ?a></a>
</lia>
<li class="list-group-item">
<a href="/<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?a>">
<?php echo JText::_('COM_USERS_LOGIN_REMIND'); ?></a>
</li>
</ul>
Once done, save it.
Step 2 - Remove the Links From the Login Module
Now you have to remove the code from the module files. To do this, again navigate to Extensions > Templates > Templates > Select the template. In our previous step, we have created an override for Com_Users. Now we will create overrides for mod_login. So navigate to Create overrides > Modules > mod_login.
Click on it and it will generate a set of files in .templates/your-template-name/html/mod_login/
Now, go to Editor tab and find default.php file under mod_login
Find below the given code and remove it from the file. This code can be different depending upon your template. I am using Astroid Template One for this example.
<div class="form-check form-group d-flex justify-content-end">
<a class="forget-password-link" href="/<?php echo JRoute::_('index.php?option=com_users&view=reset'); ?>"><?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_PASSWORD'); ?></a>
</div>
And
<li>
<a class="login-help-link" href="/<?php echo JRoute::_('index.php?option=com_users&view=remind'); ?>">
<?php echo JText::_('MOD_LOGIN_FORGOT_YOUR_USERNAME'); ?></a>
</li>
Once done, hit the Save button.
Note: To make it easy to find the code, look for the MOD_LOGIN_FORGOT_YOUR_PASSWORD
and MOD_LOGIN_FORGOT_YOUR_USERNAME
and remove the code starting with div or li.
At last, refresh the login page and you will see that these links are no longer there.
This is how you can remove the Forget Username and Forget Password links from your Joomla login page.